@@ -394,19 +394,21 @@ window.ReactDOM["default"] = window.ReactDOM;
394394
395395( function ( global , factory ) {
396396 if ( typeof define === 'function' && define . amd ) {
397- define ( [ 'exports' , 'react' , './lib/is_react_component' , './lib/stringable' , './unsafe' ] , factory ) ;
397+ define ( [ 'exports' , 'react' , './lib/is_react_component' , './lib/stringable' , './unsafe' , './lib/filter_props_from' ] , factory ) ;
398398 } else if ( typeof exports !== 'undefined' ) {
399- factory ( exports , require ( 'react' ) , require ( './lib/is_react_component' ) , require ( './lib/stringable' ) , require ( './unsafe' ) ) ;
399+ factory ( exports , require ( 'react' ) , require ( './lib/is_react_component' ) , require ( './lib/stringable' ) , require ( './unsafe' ) , require ( './lib/filter_props_from' ) ) ;
400400 } else {
401401 var mod = {
402402 exports : { }
403403 } ;
404- factory ( mod . exports , global . React , global . is_react_component , global . stringable , global . unsafe ) ;
404+ factory ( mod . exports , global . React , global . is_react_component , global . stringable , global . unsafe , global . filter_props_from ) ;
405405 global . td = mod . exports ;
406406 }
407- } ) ( this , function ( exports , _react , _libIs_react_component , _libStringable , _unsafe ) {
407+ } ) ( this , function ( exports , _react , _libIs_react_component , _libStringable , _unsafe , _libFilter_props_from ) {
408408 'use strict' ;
409409
410+ var _extends = Object . assign || function ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] ; for ( var key in source ) { if ( Object . prototype . hasOwnProperty . call ( source , key ) ) { target [ key ] = source [ key ] ; } } } return target ; } ;
411+
410412 var _createClass = ( function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( 'value' in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ) ( ) ;
411413
412414 var _get = function get ( _x , _x2 , _x3 ) { var _again = true ; _function: while ( _again ) { var object = _x , property = _x2 , receiver = _x3 ; _again = false ; if ( object === null ) object = Function . prototype ; var desc = Object . getOwnPropertyDescriptor ( object , property ) ; if ( desc === undefined ) { var parent = Object . getPrototypeOf ( object ) ; if ( parent === null ) { return undefined ; } else { _x = parent ; _x2 = property ; _x3 = receiver ; _again = true ; desc = parent = undefined ; continue _function; } } else if ( 'value' in desc ) { return desc . value ; } else { var getter = desc . get ; if ( getter === undefined ) { return undefined ; } return getter . call ( receiver ) ; } } } ;
@@ -425,50 +427,44 @@ window.ReactDOM["default"] = window.ReactDOM;
425427 }
426428
427429 _createClass ( Td , [ {
428- key : 'handleClick ' ,
429- value : function handleClick ( e ) {
430- if ( typeof this . props . handleClick === 'function ') {
431- return this . props . handleClick ( e , this ) ;
430+ key : 'stringifyIfNotReactComponent ' ,
431+ value : function stringifyIfNotReactComponent ( object ) {
432+ if ( ! ( 0 , _libIs_react_component . isReactComponent ) ( object ) && ( 0 , _libStringable . stringable ) ( object ) && typeof object !== 'undefined ') {
433+ return object . toString ( ) ;
432434 }
435+ return null ;
433436 }
434437 } , {
435438 key : 'render' ,
436439 value : function render ( ) {
437- var tdProps = {
438- className : this . props . className ,
439- onClick : this . handleClick . bind ( this )
440- } ;
441-
442- if ( typeof this . props . style !== 'undefined' ) {
443- tdProps . style = this . props . style ;
444- }
445-
446440 // Attach any properties on the column to this Td object to allow things like custom event handlers
441+ var mergedProps = ( 0 , _libFilter_props_from . filterPropsFrom ) ( this . props ) ;
447442 if ( typeof this . props . column === 'object' ) {
448443 for ( var key in this . props . column ) {
449444 if ( key !== 'key' && key !== 'name' ) {
450- tdProps [ key ] = this . props . column [ key ] ;
445+ mergedProps [ key ] = this . props . column [ key ] ;
451446 }
452447 }
453448 }
449+ // handleClick aliases onClick event
450+ mergedProps . onClick = this . props . handleClick ;
454451
455- var data = this . props . data ;
456-
457- if ( typeof this . props . children !== 'undefined' ) {
458- if ( ( 0 , _libIs_react_component . isReactComponent ) ( this . props . children ) ) {
459- data = this . props . children ;
460- } else if ( typeof this . props . data === 'undefined' && ( 0 , _libStringable . stringable ) ( this . props . children ) ) {
461- data = this . props . children . toString ( ) ;
462- }
452+ var stringifiedChildProps ;
463453
464- if ( ( 0 , _unsafe . isUnsafe ) ( this . props . children ) ) {
465- tdProps . dangerouslySetInnerHTML = { __html : this . props . children . toString ( ) } ;
466- } else {
467- tdProps . children = data ;
468- }
454+ if ( typeof this . props . data === 'undefined' ) {
455+ stringifiedChildProps = this . stringifyIfNotReactComponent ( this . props . children ) ;
469456 }
470457
471- return _react [ 'default' ] . createElement ( 'td' , tdProps ) ;
458+ if ( ( 0 , _unsafe . isUnsafe ) ( this . props . children ) ) {
459+ return _react [ 'default' ] . createElement ( 'td' , _extends ( { } , mergedProps , {
460+ dangerouslySetInnerHTML : { __html : this . props . children . toString ( ) } } ) ) ;
461+ } else {
462+ return _react [ 'default' ] . createElement (
463+ 'td' ,
464+ mergedProps ,
465+ stringifiedChildProps || this . props . children
466+ ) ;
467+ }
472468 }
473469 } ] ) ;
474470
0 commit comments