Skip to content

Commit

Permalink
fix(data-tables): Add column wrap support (#2921)
Browse files Browse the repository at this point in the history
* fix(data-tables): Add column wrap support

* Bump column support to 15

* Remove striped support
  • Loading branch information
brandonferrua authored Nov 16, 2017
1 parent d6259b8 commit b841961
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
32 changes: 32 additions & 0 deletions ui/components/data-tables/base/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,38 @@
}
}

$max-column-support: 15;

@for $i from 1 through $max-column-support {

.slds-table_column-#{$i}-wrap tbody tr > *:nth-child(#{$i}) .slds-truncate {
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: none;
white-space: normal;
}
}

[class*="slds-table_column-"] tr td .slds-truncate {
overflow: hidden;
position: relative;
max-height: 3.25rem;

&:after {
content: '';
position: absolute;
top: 2.25rem;
bottom: 0;
right: 0;
width: 50%;
background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 69%);
}
}

[class*="slds-table_column-"] tr:hover td .slds-truncate:after {
background: linear-gradient(to right, rgba(250, 250, 249, 0) 0%, rgba(250, 250, 249, 1) 69%);
}

/**
* Resizable data table columns
*
Expand Down
3 changes: 2 additions & 1 deletion ui/components/data-tables/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export const AdvancedDataTable = props => (
'slds-table slds-table_bordered slds-table_resizable-cols slds-table_fixed-layout',
props.className,
{
'slds-table_edit': props.isEditable
'slds-table_edit': props.isEditable,
'slds-table_column-3-wrap': props.columnWrap
}
)}
role="grid"
Expand Down

0 comments on commit b841961

Please sign in to comment.