All files / src/components/tek-grid/tek-grid-toolbar-provider/export-options button-option.ts

100% Statements 6/6
100% Branches 3/3
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27        112x       266x       266x 266x 266x             1x          
import { IComponent } from '../../../zd-component/interfaces';
import { IExportable, ITekGridExportConfig } from '../../interfaces';
import { IExportOption } from './interfaces';
 
export class ButtonOption implements IExportOption {
	private config: ITekGridExportConfig;
 
	constructor(config: ITekGridExportConfig) {
		this.config = config;
	}
 
	buildComponent(grid: IComponent & IExportable) {
		const { type, label, portrait = true, iconName } = this.config;
		const orientation = portrait ? 'portrait' : 'landscape';
		return {
			label,
			iconName,
			name: `${grid.name}_export_${type}_${orientation}`,
			component: 'ZdButton',
			flat: true,
			events: {
				click: () => grid.getReport(type, portrait) as any,
			},
		};
	}
}