Skip to content

Commit a0485af

Browse files
committed
commit missing built files
1 parent b7bfdc5 commit a0485af

File tree

3 files changed

+69
-7
lines changed

3 files changed

+69
-7
lines changed

lib/reactable/lib/filter_props_from.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,23 @@ var internalProps = {
99
columns: true,
1010
sortable: true,
1111
filterable: true,
12+
filtering: true,
13+
onFilter: true,
14+
filterPlaceholder: true,
1215
filterClassName: true,
16+
currentFilter: true,
17+
sort: true,
1318
sortBy: true,
19+
sortableColumns: true,
20+
onSort: true,
1421
defaultSort: true,
22+
defaultSortDescending: true,
1523
itemsPerPage: true,
24+
filterBy: true,
25+
hideFilterInput: true,
26+
noDataText: true,
27+
currentPage: true,
28+
pageButtonLimit: true,
1629
childNode: true,
1730
data: true,
1831
children: true

lib/reactable/paginator.js

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ function pageHref(num) {
2525
var Paginator = (function (_React$Component) {
2626
_inherits(Paginator, _React$Component);
2727

28-
function Paginator() {
28+
function Paginator(props) {
2929
_classCallCheck(this, Paginator);
3030

31-
_get(Object.getPrototypeOf(Paginator.prototype), 'constructor', this).apply(this, arguments);
31+
_get(Object.getPrototypeOf(Paginator.prototype), 'constructor', this).call(this, props);
32+
33+
if (this.props.rowOptions) {
34+
this.rowOptions = this.props.rowOptions.split(',').map(function (option) {
35+
if (option === 'all') return 'all';
36+
return parseInt(option, 10);
37+
});
38+
}
3239
}
3340

3441
_createClass(Paginator, [{
@@ -141,9 +148,22 @@ var Paginator = (function (_React$Component) {
141148
_react2['default'].createElement(
142149
'td',
143150
{ colSpan: this.props.colSpan },
144-
this.renderPrevious(),
145-
pageButtons,
146-
this.renderNext()
151+
this.rowOptions ? _react2['default'].createElement(
152+
'span',
153+
{ className: 'row-selector' },
154+
_react2['default'].createElement(RowSelector, {
155+
options: this.rowOptions,
156+
selected: this.props.itemsPerPage,
157+
onItemsPerPageChange: this.props.onItemsPerPageChange }),
158+
'rows per page.'
159+
) : null,
160+
numPages > 1 ? _react2['default'].createElement(
161+
'span',
162+
{ className: 'pagination-buttons' },
163+
this.renderPrevious(),
164+
pageButtons,
165+
this.renderNext()
166+
) : null
147167
)
148168
)
149169
);
@@ -155,3 +175,27 @@ var Paginator = (function (_React$Component) {
155175

156176
exports.Paginator = Paginator;
157177
;
178+
179+
function RowSelector(props) {
180+
var options = props.options.map(function (opt, i) {
181+
if (opt === 'all') return _react2['default'].createElement(
182+
'option',
183+
{ key: i, value: Number.MAX_SAFE_INTEGER, selected: isSelected },
184+
'all'
185+
);
186+
var isSelected = opt === props.selected;
187+
return _react2['default'].createElement(
188+
'option',
189+
{ key: i, value: opt, selected: isSelected },
190+
opt
191+
);
192+
});
193+
194+
return _react2['default'].createElement(
195+
'select',
196+
{ onChange: function (e) {
197+
return props.onItemsPerPageChange(parseInt(e.target.value, 10));
198+
} },
199+
options
200+
);
201+
}

lib/reactable/table.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var Table = (function (_React$Component) {
5050
column: null,
5151
direction: this.props.defaultSortDescending ? -1 : 1
5252
},
53+
itemsPerPage: this.props.itemsPerPage || 0,
5354
filter: ''
5455
};
5556

@@ -485,15 +486,14 @@ var Table = (function (_React$Component) {
485486
}
486487

487488
// Determine pagination properties and which columns to display
488-
var itemsPerPage = 0;
489+
var itemsPerPage = this.state.itemsPerPage;
489490
var pagination = false;
490491
var numPages = undefined;
491492
var currentPage = this.state.currentPage;
492493
var pageButtonLimit = this.props.pageButtonLimit || 10;
493494

494495
var currentChildren = filteredChildren;
495496
if (this.props.itemsPerPage > 0) {
496-
itemsPerPage = this.props.itemsPerPage;
497497
numPages = Math.ceil(filteredChildren.length / itemsPerPage);
498498

499499
if (currentPage > numPages - 1) {
@@ -548,12 +548,17 @@ var Table = (function (_React$Component) {
548548
pageButtonLimit: pageButtonLimit,
549549
numPages: numPages,
550550
currentPage: currentPage,
551+
rowOptions: this.props.rowOptions,
552+
itemsPerPage: itemsPerPage,
551553
onPageChange: function (page) {
552554
_this.setState({ currentPage: page });
553555
if (_this.props.onPageChange) {
554556
_this.props.onPageChange(page);
555557
}
556558
},
559+
onItemsPerPageChange: function (itemsPerPage) {
560+
return _this.setState({ itemsPerPage: itemsPerPage });
561+
},
557562
previousPageLabel: this.props.previousPageLabel,
558563
nextPageLabel: this.props.nextPageLabel,
559564
key: 'paginator' }) : null,

0 commit comments

Comments
 (0)