Adjust Table component styles and markup to maintain fixed column widths, regardless of cell content.

- Fix ellipsis-truncation of text in IE11 and Edge.
- Update Visualize landing table markup.
This commit is contained in:
CJ Cenizal 2017-02-15 11:45:49 -08:00
parent 9b447c53c1
commit e423918163
4 changed files with 72 additions and 21 deletions

View file

@ -117,7 +117,10 @@
>
</th>
<th class="kuiTableHeaderCell" ng-click="listingController.sortOn('title')">
<th
class="kuiTableHeaderCell"
ng-click="listingController.sortOn('title')"
>
Name
<span
class="kuiIcon"
@ -126,7 +129,10 @@
></span>
</th>
<th class="kuiTableHeaderCell" ng-click="listingController.sortOn('type')">
<th
class="kuiTableHeaderCell"
ng-click="listingController.sortOn('type')"
>
Type
<span
class="kuiIcon"
@ -143,12 +149,14 @@
class="kuiTableRow"
>
<td class="kuiTableRowCell kuiTableRowCell--checkBox">
<input
type="checkbox"
class="kuiCheckBox"
ng-click="listingController.toggleItem(item)"
ng-checked="listingController.isItemChecked(item)"
>
<div class="kuiTableRowCell__liner">
<input
type="checkbox"
class="kuiCheckBox"
ng-click="listingController.toggleItem(item)"
ng-checked="listingController.isItemChecked(item)"
>
</div>
</td>
<td class="kuiTableRowCell">

View file

@ -1,15 +1,23 @@
$tableCellPadding: 7px 8px 8px;
/**
* 1. Prevent cells from expanding based on content size. This substitutes for table-layout: fixed.
*/
@mixin tableCell {
font-size: $fontSize;
font-weight: 400;
line-height: $lineHeight;
padding: 7px 8px 8px;
text-align: left;
max-width: 20px; /* 1 */
&:last-child {
padding-right: 16px;
}
}
/**
* NOTE: table-layout: fixed causes a bug in IE11 and Edge (see #9929). It also prevents us from
* specifying a column width, e.g. the checkbox column.
*/
.kuiTable {
width: 100%;
border: $tableBorder;
@ -19,6 +27,8 @@
.kuiTableHeaderCell {
@include tableCell;
padding: $tableCellPadding;
line-height: $lineHeight;
color: #a7a7a7;
}
@ -64,11 +74,15 @@
/**
* 1. Vertically align all children.
* 2. Truncate text with an ellipsis. The padding on this div allows the ellipsis to show. If
* the padding was on the cell, the ellipsis would be cropped.
*/
.kuiTableRowCell__liner {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; /* 2 */
overflow: hidden; /* 2 */
text-overflow: ellipsis; /* 2 */
padding: $tableCellPadding; /* 2 */
line-height: $lineHeight; /* 1 */
& > * {
vertical-align: middle; /* 1 */
@ -86,10 +100,15 @@
/**
* 1. Rendered width of cell with checkbox inside of it.
* 2. Align checkbox with text in other cells.
* 3. Show the checkbox in Edge; otherwise it gets cropped.
*/
.kuiTableHeaderCell--checkBox,
.kuiTableRowCell--checkBox {
width: 28px; /* 1 */
padding-right: 0;
line-height: 1;
line-height: 1; /* 2 */
.kuiTableRowCell__liner {
overflow: visible; /* 3 */
}
}

View file

@ -1352,6 +1352,13 @@ body {
border-top: none;
/* 2 */ }
/**
* 1. Prevent cells from expanding based on content size. This substitutes for table-layout: fixed.
*/
/**
* NOTE: table-layout: fixed causes a bug in IE11 and Edge (see #9929). It also prevents us from
* specifying a column width, e.g. the checkbox column.
*/
.kuiTable {
width: 100%;
border: 2px solid #E4E4E4;
@ -1361,9 +1368,11 @@ body {
.kuiTableHeaderCell {
font-size: 14px;
font-weight: 400;
line-height: 1.5;
padding: 7px 8px 8px;
text-align: left;
max-width: 20px;
/* 1 */
padding: 7px 8px 8px;
line-height: 1.5;
color: #a7a7a7; }
.kuiTableHeaderCell:last-child {
padding-right: 16px; }
@ -1396,9 +1405,9 @@ body {
.kuiTableRowCell {
font-size: 14px;
font-weight: 400;
line-height: 1.5;
padding: 7px 8px 8px;
text-align: left;
max-width: 20px;
/* 1 */
color: #191E23;
border-top: 1px solid #E4E4E4; }
.kuiTableRowCell:last-child {
@ -1406,11 +1415,20 @@ body {
/**
* 1. Vertically align all children.
* 2. Truncate text with an ellipsis. The padding on this div allows the ellipsis to show. If
* the padding was on the cell, the ellipsis would be cropped.
*/
.kuiTableRowCell__liner {
white-space: nowrap;
/* 2 */
overflow: hidden;
text-overflow: ellipsis; }
/* 2 */
text-overflow: ellipsis;
/* 2 */
padding: 7px 8px 8px;
/* 2 */
line-height: 1.5;
/* 1 */ }
.kuiTableRowCell__liner > * {
vertical-align: middle;
/* 1 */ }
@ -1423,13 +1441,19 @@ body {
/**
* 1. Rendered width of cell with checkbox inside of it.
* 2. Align checkbox with text in other cells.
* 3. Show the checkbox in Edge; otherwise it gets cropped.
*/
.kuiTableHeaderCell--checkBox,
.kuiTableRowCell--checkBox {
width: 28px;
/* 1 */
padding-right: 0;
line-height: 1; }
line-height: 1;
/* 2 */ }
.kuiTableHeaderCell--checkBox .kuiTableRowCell__liner,
.kuiTableRowCell--checkBox .kuiTableRowCell__liner {
overflow: visible;
/* 3 */ }
.kuiTabs {
display: -webkit-box;

View file

@ -88,7 +88,7 @@
</td>
<td class="kuiTableRowCell">
<div class="kuiTableRowCell__liner">
<a class="kuiLink" href="#">Celebration</a>
<a class="kuiLink" href="#">Celebration of some very long content that will affect cell width and should eventually become truncated</a>
</div>
</td>
<td class="kuiTableRowCell">