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, pageWidth: 64,
pageHeight: 32, pageHeight: 32,
}), }),
// rectangle_3x1_code128: new LabelLayout({ rectangle_3x1_code128: new LabelLayout({
// name: '3in x 1in Rectangular Label - CODE128', name: '3in x 1in Rectangular Label - CODE128',
// barcodeType: 'code128', barcodeType: 'code128',
// id: 'rectangle_3x1_code128', id: 'rectangle_3x1_code128',
// pageWidth: 76.2 + labelMargin, pageWidth: 76.2 + labelMargin,
// pageHeight: 25.4 + labelMargin, pageHeight: 25.4 + labelMargin,
// delimiter: '', delimiter: '',
// }), hide: true,
// rectangle_code128: new LabelLayout({ }),
// name: '2.75in x 1.25in Rectangular Label - CODE128', rectangle_code128: new LabelLayout({
// barcodeType: 'code128', name: '2.75in x 1.25in Rectangular Label - CODE128',
// id: 'rectangle_code128', barcodeType: 'code128',
// pageWidth: 69.9 + labelMargin, id: 'rectangle_code128',
// pageHeight: 31.8 + labelMargin, pageWidth: 69.9 + labelMargin,
// delimiter: '', pageHeight: 31.8 + labelMargin,
// }), delimiter: '',
// rectangle_datamatrix: new LabelLayout({ hide: true,
// name: '2in x 1in Rectangular Label - DataMatrix', }),
// barcodeType: 'datamatrix', rectangle_datamatrix: new LabelLayout({
// id: 'rectangle_datamatrix', name: '2in x 1in Rectangular Label - DataMatrix',
// pageWidth: 50.8 + labelMargin, barcodeType: 'datamatrix',
// pageHeight: 25.4 + labelMargin, id: 'rectangle_datamatrix',
// }), pageWidth: 50.8 + labelMargin,
pageHeight: 25.4 + labelMargin,
hide: true,
}),
rectangle_datamatrixrectangular: new LabelLayout({ rectangle_datamatrixrectangular: new LabelLayout({
name: '2in x 1in Rectangular Label - DataMatrix Rectangular', name: '2in x 1in Rectangular Label - DataMatrix Rectangular',
barcodeType: 'datamatrixrectangular', barcodeType: 'datamatrixrectangular',

View File

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

View File

@ -28,7 +28,7 @@
#labelLayoutSelect="matSelect" #labelLayoutSelect="matSelect"
[formControl]="labelLayoutFormControl" [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 <mat-option
*ngFor="let layout of allLabelLayouts" *ngFor="let layout of allLabelLayouts"
[value]="layout.id" [value]="layout.id"

View File

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