@@ -4,25 +4,26 @@ import { PluginFactory } from "@renderer/factory/plugin.factory";
44import { ConfigFactory } from "@renderer/factory/config.factory" ;
55import { StringUtils } from "@renderer/utils/string.utils" ;
66import { RequestModel } from "@renderer/model/request.model" ;
7- import { ResponseDataModel } from "@renderer/model/response.model" ;
87
98@Component ( {
10- selector : 'object-designer-layout-content-detail -table' ,
11- templateUrl : './detail .table.view.html' ,
12- styleUrls : [ './detail .table.style.scss' ]
9+ selector : 'object-designer-layout-content-preview -table' ,
10+ templateUrl : './preview .table.view.html' ,
11+ styleUrls : [ './preview .table.style.scss' ]
1312} )
14- export class LayoutDetailTableComponent implements AfterViewInit {
13+ export class PreviewTableComponent implements AfterViewInit {
1514 @Input ( )
1615 applyData : DesignerApplyData ;
1716
18- tableData = new ResponseDataModel ( ) ;
19- tableDataSize = 0 ;
2017 loading = {
2118 tableContainer : false
2219 }
2320 applyResult = {
2421 headers : [ ] ,
25- columns : [ ]
22+ columns : [ ] ,
23+ checkedColumns : [ ]
24+ }
25+ applyVisible = {
26+ columnDrawer : false
2627 }
2728
2829 constructor ( private pluginFactory : PluginFactory ,
@@ -32,7 +33,6 @@ export class LayoutDetailTableComponent implements AfterViewInit {
3233 ngAfterViewInit ( ) : void {
3334 setTimeout ( ( ) => {
3435 this . loading . tableContainer = true ;
35- this . tableDataSize = 0 ;
3636 const request = new RequestModel ( ) ;
3737 request . config = this . applyData . dataSource ;
3838 const type = this . applyData . dataSource . type ;
@@ -43,10 +43,10 @@ export class LayoutDetailTableComponent implements AfterViewInit {
4343 . getResponse ( request , sql )
4444 . then ( response => {
4545 if ( response . status ) {
46- this . tableDataSize = response . data . rows ;
47- if ( this . tableDataSize > 0 ) {
46+ if ( response . data . rows > 0 ) {
4847 Object . keys ( response . data . columns [ 0 ] ) . forEach ( column => {
4948 this . applyResult . headers . push ( column ) ;
49+ this . applyResult . checkedColumns . push ( { label : column , value : column , checked : true } )
5050 } )
5151 this . applyResult . columns = response . data . columns ;
5252 }
@@ -55,4 +55,18 @@ export class LayoutDetailTableComponent implements AfterViewInit {
5555 } ) ;
5656 } , 0 ) ;
5757 }
58+
59+ handlerShowColumnDrawer ( ) {
60+ this . applyVisible . columnDrawer = true ;
61+ }
62+
63+ handlerCloseColumnDrawer ( ) {
64+ this . applyVisible . columnDrawer = false ;
65+ }
66+
67+ handlerColumnChecked ( ) {
68+ this . applyResult . headers = this . applyResult . checkedColumns
69+ . filter ( item => item . checked )
70+ . map ( item => item . value ) ;
71+ }
5872}
0 commit comments