aa203090850b8176794ec1d45068120cc6fb75e9
[vid.git] / vid-webpack-master / src / app / browseSdc / vid-table / vid-table.component.ts
1 /**
2  * Created by cp2122 on 1/2/2018.
3  */
4 import { Component, Input, EventEmitter, Output } from '@angular/core';
5 export class CustomTableColumnDefinition {
6   public displayName = '';
7   public key = '';
8   public type? = 'text';
9   public text? = ''; // for button
10   public action? = ''; // for button - callback
11   public showCondition? = ''; // for button
12   // public binding = '';
13   public filter? = '';
14   // public computedClass: any;
15   // public isComputed = false;
16   // public isAnchor = false;
17   // public srefBinding = '';
18 }
19
20 export class CustomTableConfig {
21   public sortBy = '';
22   public sortOrder = 'desc';
23   public pageSize? = 10;
24   public pageNumber? = 1;
25   public totalCount? = 0;
26   public totalPages? = 0;
27   public maxSize? = 10;
28   public showSelectCheckbox? = false;
29   public showSelectAll? = true;
30   public showSort? = true;
31   public clientSort? = true;
32   public clientPaging? = true;
33   public stickyHeader? = true;
34   public stickyHeaderOffset? = 0;
35   public stickyContainer? = '';
36 }
37
38 export class CustomTableOptions {
39   public data: any[];
40   public columns: Array<CustomTableColumnDefinition>;
41   public config: CustomTableConfig;
42   // public callbacks: any;
43 }
44 @Component({
45   selector: 'vid-table',
46   styleUrls: ['./vid-table.component.scss'],
47   templateUrl: './vid-table.component.html'
48 })
49
50 export class VidTableComponent {
51   @Input() options: CustomTableOptions;
52   @Input() filterQuery = '';
53
54   @Output() clickEvent = new EventEmitter<any>();
55   clickBtn(row, actionName) {
56     row.actionName = actionName;
57     this.clickEvent.emit(row);
58   }
59 }