@@ -23,6 +23,42 @@ var __assign = (this && this.__assign) || function () {
2323 } ;
2424 return __assign . apply ( this , arguments ) ;
2525} ;
26+ var __awaiter = ( this && this . __awaiter ) || function ( thisArg , _arguments , P , generator ) {
27+ function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
28+ return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
29+ function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
30+ function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
31+ function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
32+ step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
33+ } ) ;
34+ } ;
35+ var __generator = ( this && this . __generator ) || function ( thisArg , body ) {
36+ var _ = { label : 0 , sent : function ( ) { if ( t [ 0 ] & 1 ) throw t [ 1 ] ; return t [ 1 ] ; } , trys : [ ] , ops : [ ] } , f , y , t , g ;
37+ return g = { next : verb ( 0 ) , "throw" : verb ( 1 ) , "return" : verb ( 2 ) } , typeof Symbol === "function" && ( g [ Symbol . iterator ] = function ( ) { return this ; } ) , g ;
38+ function verb ( n ) { return function ( v ) { return step ( [ n , v ] ) ; } ; }
39+ function step ( op ) {
40+ if ( f ) throw new TypeError ( "Generator is already executing." ) ;
41+ while ( _ ) try {
42+ if ( f = 1 , y && ( t = op [ 0 ] & 2 ? y [ "return" ] : op [ 0 ] ? y [ "throw" ] || ( ( t = y [ "return" ] ) && t . call ( y ) , 0 ) : y . next ) && ! ( t = t . call ( y , op [ 1 ] ) ) . done ) return t ;
43+ if ( y = 0 , t ) op = [ op [ 0 ] & 2 , t . value ] ;
44+ switch ( op [ 0 ] ) {
45+ case 0 : case 1 : t = op ; break ;
46+ case 4 : _ . label ++ ; return { value : op [ 1 ] , done : false } ;
47+ case 5 : _ . label ++ ; y = op [ 1 ] ; op = [ 0 ] ; continue ;
48+ case 7 : op = _ . ops . pop ( ) ; _ . trys . pop ( ) ; continue ;
49+ default :
50+ if ( ! ( t = _ . trys , t = t . length > 0 && t [ t . length - 1 ] ) && ( op [ 0 ] === 6 || op [ 0 ] === 2 ) ) { _ = 0 ; continue ; }
51+ if ( op [ 0 ] === 3 && ( ! t || ( op [ 1 ] > t [ 0 ] && op [ 1 ] < t [ 3 ] ) ) ) { _ . label = op [ 1 ] ; break ; }
52+ if ( op [ 0 ] === 6 && _ . label < t [ 1 ] ) { _ . label = t [ 1 ] ; t = op ; break ; }
53+ if ( t && _ . label < t [ 2 ] ) { _ . label = t [ 2 ] ; _ . ops . push ( op ) ; break ; }
54+ if ( t [ 2 ] ) _ . ops . pop ( ) ;
55+ _ . trys . pop ( ) ; continue ;
56+ }
57+ op = body . call ( thisArg , _ ) ;
58+ } catch ( e ) { op = [ 6 , e ] ; y = 0 ; } finally { f = t = 0 ; }
59+ if ( op [ 0 ] & 5 ) throw op [ 1 ] ; return { value : op [ 0 ] ? op [ 1 ] : void 0 , done : true } ;
60+ }
61+ } ;
2662exports . __esModule = true ;
2763var React = require ( "react" ) ;
2864var ReactDOM = require ( "react-dom" ) ;
@@ -54,23 +90,34 @@ var default_1 = /** @class */ (function (_super) {
5490 return _this ;
5591 }
5692 default_1 . prototype . componentDidMount = function ( ) {
57- var domEle = ReactDOM . findDOMNode ( this . ref ) ; // mounted DOM element
58- var that = this ;
59- var _a = this . props , columns = _a . columns , data = _a . data , options = _a . options ;
60- var propOptions = ConfigUtils_1 . propsToOptions ( this . props ) ;
61- new Tabulator ( domEle , __assign ( __assign ( __assign ( __assign ( { columns : columns } , propOptions ) , { layout : 'fitColumns' , // fit columns to width of table (optional)
62- tableBuilding : function ( ) {
63- that . table = this ; // keep table instance
64- that . props . tableBuilding ? that . props . tableBuilding ( ) : '' ;
65- } ,
66- dataLoaded : function ( ) {
67- that . props . dataLoaded ? that . props . dataLoaded ( ) : '' ;
68- } , invalidOptionWarnings : false } ) , options ) , { data : data } ) ) ;
69- // await table.setData(data);
70- // console.log('- componentDidMount');
71- if ( data && data . length > 0 ) {
72- this . setState ( { data : data } ) ;
73- }
93+ return __awaiter ( this , void 0 , void 0 , function ( ) {
94+ var domEle , that , _a , columns , data , options , propOptions ;
95+ return __generator ( this , function ( _b ) {
96+ switch ( _b . label ) {
97+ case 0 :
98+ domEle = ReactDOM . findDOMNode ( this . ref ) ;
99+ that = this ;
100+ _a = this . props , columns = _a . columns , data = _a . data , options = _a . options ;
101+ return [ 4 /*yield*/ , ConfigUtils_1 . propsToOptions ( this . props ) ] ;
102+ case 1 :
103+ propOptions = _b . sent ( ) ;
104+ new Tabulator ( domEle , __assign ( __assign ( __assign ( __assign ( { columns : columns } , propOptions ) , { layout : 'fitColumns' , // fit columns to width of table (optional)
105+ tableBuilding : function ( ) {
106+ that . table = this ; // keep table instance
107+ that . props . tableBuilding ? that . props . tableBuilding ( ) : '' ;
108+ } ,
109+ dataLoaded : function ( ) {
110+ that . props . dataLoaded ? that . props . dataLoaded ( ) : '' ;
111+ } , invalidOptionWarnings : false } ) , options ) , { data : data } ) ) ;
112+ // await table.setData(data);
113+ // console.log('- componentDidMount');
114+ if ( data && data . length > 0 ) {
115+ this . setState ( { data : data } ) ;
116+ }
117+ return [ 2 /*return*/ ] ;
118+ }
119+ } ) ;
120+ } ) ;
74121 } ;
75122 default_1 . prototype . componentWillUnmount = function ( ) {
76123 this . table . destroy ( ) ;
0 commit comments