1
1
'use strict' ;
2
2
3
- var _lodashLangIsObject2 = require ( 'lodash/lang/isObject' ) ;
4
-
5
- var _lodashLangIsObject3 = _interopRequireDefault ( _lodashLangIsObject2 ) ;
6
-
7
3
Object . defineProperty ( exports , '__esModule' , {
8
4
value : true
9
5
} ) ;
10
6
11
- 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 ; } ; } ) ( ) ;
12
-
13
- var _get = function get ( _x , _x2 , _x3 ) { var _again = true ; _function: while ( _again ) { var object = _x , property = _x2 , receiver = _x3 ; desc = parent = getter = undefined ; _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 ; continue _function; } } else if ( 'value' in desc ) { return desc . value ; } else { var getter = desc . get ; if ( getter === undefined ) { return undefined ; } return getter . call ( receiver ) ; } } } ;
14
-
15
- function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( 'Cannot call a class as a function' ) ; } }
16
-
17
- function _inherits ( subClass , superClass ) { if ( typeof superClass !== 'function' && superClass !== null ) { throw new TypeError ( 'Super expression must either be null or a function, not ' + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
18
-
19
- var _linkClass = require ( './linkClass' ) ;
7
+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { 'default' : obj } ; }
20
8
21
- var _linkClass2 = _interopRequireDefault ( _linkClass ) ;
9
+ var _extendReactClass = require ( './extendReactClass' ) ;
22
10
23
- var _react = require ( 'react' ) ;
11
+ var _extendReactClass2 = _interopRequireDefault ( _extendReactClass ) ;
24
12
25
- var _react2 = _interopRequireDefault ( _react ) ;
13
+ var _wrapStatelessFunction = require ( './wrapStatelessFunction' ) ;
26
14
27
- function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { 'default' : obj } ; }
15
+ var _wrapStatelessFunction2 = _interopRequireDefault ( _wrapStatelessFunction ) ;
28
16
29
17
var decoratorConstructor = undefined ,
30
18
functionConstructor = undefined ;
@@ -40,41 +28,7 @@ var decoratorConstructor = undefined,
40
28
functionConstructor = function ( Component , defaultStyles , options ) {
41
29
var decoratedClass = undefined ;
42
30
43
- decoratedClass = ( function ( _Component ) {
44
- _inherits ( _class , _Component ) ;
45
-
46
- function _class ( ) {
47
- _classCallCheck ( this , _class ) ;
48
-
49
- _get ( Object . getPrototypeOf ( _class . prototype ) , 'constructor' , this ) . apply ( this , arguments ) ;
50
- }
51
-
52
- _createClass ( _class , [ {
53
- key : 'render' ,
54
- value : function render ( ) {
55
- var renderResult = undefined ,
56
- styles = undefined ;
57
-
58
- if ( this . props . styles ) {
59
- styles = this . props . styles ;
60
- } else if ( ( 0 , _lodashLangIsObject3 [ 'default' ] ) ( defaultStyles ) ) {
61
- styles = defaultStyles ;
62
- } else {
63
- styles = { } ;
64
- }
65
-
66
- renderResult = _get ( Object . getPrototypeOf ( _class . prototype ) , 'render' , this ) . call ( this ) ;
67
-
68
- if ( renderResult ) {
69
- return ( 0 , _linkClass2 [ 'default' ] ) ( renderResult , styles , options ) ;
70
- }
71
-
72
- return _react2 [ 'default' ] . createElement ( 'noscript' ) ;
73
- }
74
- } ] ) ;
75
-
76
- return _class ;
77
- } ) ( Component ) ;
31
+ decoratedClass = Component . isReactClass ? ( 0 , _extendReactClass2 [ 'default' ] ) ( Component , defaultStyles , options ) : ( 0 , _wrapStatelessFunction2 [ 'default' ] ) ( Component , defaultStyles , options ) ;
78
32
79
33
if ( Component . displayName ) {
80
34
decoratedClass . displayName = Component . displayName ;
0 commit comments