Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Updates for SortableTable #2597

Merged
merged 4 commits into from
Jul 31, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions imports/plugins/core/ui/client/components/table/sortableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,37 @@ class SortableTable extends Component {
renderTableFilter() {
const { filterType } = this.props;

if (filterType === "both" || filterType === "table") {
return (
<SortableTableFilter
onChange={this.handleFilterInput}
value={this.state.filterInput}
name="filterInput"
/>
);
if (this.getMeteorData().matchingResults !== 0) {
if (filterType === "both" || filterType === "table") {
return (
<SortableTableFilter
onChange={this.handleFilterInput}
value={this.state.filterInput}
name="filterInput"
/>
);
}
}

return null;
}

renderPaginationBottom = () => {
if (this.getMeteorData().matchingResults === 0) {
return false;
}

return true;
}

setMinRows = () => {
if (this.getMeteorData().matchingResults === 0) {
return 3;
}

return 0;
}


render() {
const { ...otherProps } = this.props;
Expand All @@ -199,15 +217,17 @@ class SortableTable extends Component {
defaultFilterMethod={this.customFilter}
defaultPageSize={otherProps.defaultPageSize}
filterable={this.renderColumnFilter()}
minRows={otherProps.minRows}
minRows={this.setMinRows()
}
previousText={otherProps.previousText}
nextText={otherProps.nextText}
loadingText={otherProps.loadingText}
noDataText={otherProps.noDataText}
noDataText={() => <span className="sortableTable-noDataText">{this.props.noDataMessage}</span>}
pageText={otherProps.pageText}
ofText={otherProps.ofText}
rowsText={otherProps.rowsText}
PaginationComponent={SortableTablePagination}
showPaginationBottom={this.renderPaginationBottom()}
getTrProps={(state, rowInfo, column, instance) => { // eslint-disable-line no-unused-vars
return {
onClick: e => { // eslint-disable-line no-unused-vars
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@
@import "products/products.less";
@import "products/attributes.less";
@import "products/productImageGallery.less";
@import "products/productDetail.less";
// @import "products/productDetail.less";
@import "products/tags.less";
@import "products/variant.less";
// @import "products/variant.less";
@import "products/childVariant.less";
@import "products/variantForm.less";
@import "products/variantList.less";
// @import "products/variantList.less";
@import "products/productGrid.less";
@import "products/productList.less";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@
-ms-flex: 0;
flex: 0;
text-align: center;
display: flex;
justify-content: center;

.sortableTable-pagination {
padding-left: 2px;
Expand All @@ -366,7 +368,7 @@
-ms-flex: 0;
flex: 0;
text-align: center;
padding-top: 8px;
padding-top: 17px;
color: @black20;
}

Expand Down Expand Up @@ -394,7 +396,11 @@

.ReactTable .-pagination .-pageInfo {
display: inline-block;
margin: 3px 10px;
// margin: 3px 10px;
margin-left: 0px;
margin-right: 3px;
margin-top: 10px;
margin-bottom: 10px;
white-space: nowrap;
}

Expand All @@ -412,19 +418,30 @@
}

.ReactTable .rt-noData {
width: 100%;
height: 100%;
display: block;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
background: rgba(255, 255, 255, 0.8);
background: rgba(255, 255, 255, 0.60);
-webkit-transition: all .3s ease;
transition: all .3s ease;
z-index: 1;
pointer-events: none;
padding: 20px;
color: rgba(0, 0, 0, 0.5);
color: rgba(0, 0, 0, 0.9);

.sortableTable-noDataText {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
}

.ReactTable .-loading {
Expand Down Expand Up @@ -497,7 +514,7 @@

.ReactTable .select-wrap select {
padding: 5px 15px 5px 7px;
min-width: 100px;
// min-width: 100px;
}

.ReactTable .select-wrap:after {
Expand Down