@@ -34,6 +34,10 @@ var _isotopeLayout2 = _interopRequireDefault(_isotopeLayout);
3434
3535var _reactBootstrap = require ( 'react-bootstrap' ) ;
3636
37+ var _jquery = require ( 'jquery' ) ;
38+
39+ var _jquery2 = _interopRequireDefault ( _jquery ) ;
40+
3741function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
3842
3943function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
@@ -42,6 +46,16 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
4246
4347function _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 ; }
4448
49+ var columnProps = _propTypes2 . default . oneOfType ( [ _propTypes2 . default . string , _propTypes2 . default . number , _propTypes2 . default . bool , _propTypes2 . default . shape ( {
50+ size : _propTypes2 . default . oneOfType ( [ _propTypes2 . default . bool , _propTypes2 . default . number , _propTypes2 . default . string ] ) ,
51+ // example size values:
52+ // 12 || "12" => col-12 or col-`width`-12
53+ // auto => col-auto or col-`width`-auto
54+ // true => col or col-`width`
55+ order : _propTypes2 . default . oneOfType ( [ _propTypes2 . default . number , _propTypes2 . default . string ] ) ,
56+ offset : _propTypes2 . default . oneOfType ( [ _propTypes2 . default . number , _propTypes2 . default . string ] )
57+ } ) ] ) ;
58+
4559var IsotopeItem = function IsotopeItem ( _ref ) {
4660 var key = _ref . key ,
4761 id = _ref . id ,
@@ -50,7 +64,6 @@ var IsotopeItem = function IsotopeItem(_ref) {
5064 sm = _ref . sm ,
5165 md = _ref . md ,
5266 lg = _ref . lg ,
53- xl = _ref . xl ,
5467 children = _ref . children ;
5568 return width ? _react2 . default . createElement (
5669 'div' ,
@@ -64,22 +77,20 @@ var IsotopeItem = function IsotopeItem(_ref) {
6477 xs : xs ,
6578 sm : sm ,
6679 md : md ,
67- lg : lg ,
68- xl : xl
80+ lg : lg
6981 } ,
7082 children
7183 ) ;
7284} ;
7385
7486IsotopeItem . propTypes = {
7587 key : _propTypes2 . default . number ,
76- id : _propTypes2 . default . string . isRequired ,
88+ id : _propTypes2 . default . string ,
7789 width : _propTypes2 . default . number ,
78- xs : _react . columnProps ,
79- sm : _react . columnProps ,
80- md : _react . columnProps ,
81- lg : _react . columnProps ,
82- xl : _react . columnProps ,
90+ xs : columnProps ,
91+ sm : columnProps ,
92+ md : columnProps ,
93+ lg : columnProps ,
8394 children : _propTypes2 . default . node
8495} ;
8596
@@ -108,6 +119,8 @@ var IsotopeGrid = function (_React$Component) {
108119 _createClass ( IsotopeGrid , [ {
109120 key : 'createIsotope' ,
110121 value : function createIsotope ( ) {
122+ var _this2 = this ;
123+
111124 var _props = this . props ,
112125 id = _props . id ,
113126 wholeWord = _props . wholeWord ,
@@ -124,9 +137,9 @@ var IsotopeGrid = function (_React$Component) {
124137 itemSelector : '.' + id + '-item' ,
125138 layoutMode : 'fitRows' ,
126139 filter : function filter ( itemElem ) {
127- var isoSearch = itemElem . querySelector ( '.isotope-search' ) ;
140+ var isoSearch = itemElem ? itemElem . querySelector ( '.isotope-search' ) : ( 0 , _jquery2 . default ) ( _this2 ) . find ( '.isotope-search' ) ;
128141 return ( ! filterList || filterList . length === 0 || filterList . every ( function ( filter ) {
129- return filter ( itemElem ) ;
142+ return filter ( itemElem || ( 0 , _jquery2 . default ) ( _this2 ) ) ;
130143 } ) ) && reg . test ( isoSearch ? isoSearch . innerText : '' ) ;
131144 }
132145 } )
@@ -143,6 +156,8 @@ var IsotopeGrid = function (_React$Component) {
143156 } , {
144157 key : 'componentWillReceiveProps' ,
145158 value : function componentWillReceiveProps ( nextProps ) {
159+ var _this3 = this ;
160+
146161 var oldElems = [ ] ;
147162
148163 this . props . children . forEach ( function ( item ) {
@@ -171,9 +186,9 @@ var IsotopeGrid = function (_React$Component) {
171186 if ( this . props . searchTerm . toLowerCase ( ) . trim ( ) !== nextProps . searchTerm . toLowerCase ( ) . trim ( ) || JSON . stringify ( this . props . filterList ) !== JSON . stringify ( nextProps . filterList ) ) {
172187 var reg = nextProps . wholeWord ? RegExp ( '\\b' + nextProps . searchTerm . toLowerCase ( ) . trim ( ) + '\\b' , 'i' ) : RegExp ( '' + nextProps . searchTerm . toLowerCase ( ) . trim ( ) , 'i' ) ;
173188 options . filter = function ( itemElem ) {
174- var isoSearch = itemElem . querySelector ( '.isotope-search' ) ;
189+ var isoSearch = itemElem ? itemElem . querySelector ( '.isotope-search' ) : ( 0 , _jquery2 . default ) ( _this3 ) . find ( '.isotope-search' ) ;
175190 return ( ! nextProps . filterList || nextProps . filterList . length === 0 || nextProps . filterList . every ( function ( filter ) {
176- return filter ( itemElem ) ;
191+ return filter ( itemElem || ( 0 , _jquery2 . default ) ( _this3 ) ) ;
177192 } ) ) && reg . test ( isoSearch ? isoSearch . innerText : '' ) ;
178193 } ;
179194 }
@@ -213,7 +228,6 @@ var IsotopeGrid = function (_React$Component) {
213228 sm = _props2 . sm ,
214229 md = _props2 . md ,
215230 lg = _props2 . lg ,
216- xl = _props2 . xl ,
217231 children = _props2 . children ,
218232 className = _props2 . className ;
219233
@@ -249,8 +263,7 @@ var IsotopeGrid = function (_React$Component) {
249263 xs : xs ,
250264 sm : sm ,
251265 md : md ,
252- lg : lg ,
253- xl : xl
266+ lg : lg
254267 } ) ;
255268 default :
256269 return null ;
@@ -273,8 +286,7 @@ var IsotopeGrid = function (_React$Component) {
273286 xs : xs ,
274287 sm : sm ,
275288 md : md ,
276- lg : lg ,
277- xl : xl
289+ lg : lg
278290 } ) ;
279291 default :
280292 return null ;
@@ -291,11 +303,10 @@ IsotopeGrid.propTypes = {
291303 id : _propTypes2 . default . string . isRequired ,
292304 className : _propTypes2 . default . string ,
293305 width : _propTypes2 . default . number ,
294- xs : _react . columnProps ,
295- sm : _react . columnProps ,
296- md : _react . columnProps ,
297- lg : _react . columnProps ,
298- xl : _react . columnProps ,
306+ xs : columnProps ,
307+ sm : columnProps ,
308+ md : columnProps ,
309+ lg : columnProps ,
299310 children : _propTypes2 . default . node ,
300311 sortBy : _propTypes2 . default . string ,
301312 sortOrder : _propTypes2 . default . string ,
0 commit comments