All files / utils/grid-base/export-options button-option.ts

83.33% Statements 5/6
66.66% Branches 2/3
66.66% Functions 2/3
83.33% Lines 5/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 28      1x       4x           4x 4x 4x                        
import { ITekGridExportConfig, TekGrid, TekTreeGrid } from '../../../components';
import { IExportOption } from './interfaces';
 
export class ButtonOption implements IExportOption {
  private config: ITekGridExportConfig;
 
  constructor(config: ITekGridExportConfig) {
    this.config = config;
  }
 
  buildComponent(grid: TekGrid | TekTreeGrid) {
    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,
      },
    };
  }
}