Skip to content

Commit

Permalink
Merge pull request #74 from fobbyal/last-column-border-issue
Browse files Browse the repository at this point in the history
fix(cellRender.js + flexRenderer.js): added missing right border for last column
  • Loading branch information
fobbyal authored Feb 24, 2021
2 parents b25ad1f + 064a790 commit ed96d8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
18 changes: 1 addition & 17 deletions src/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,13 @@ export const BasicCell = styled.div`
cursor: default;
justify-content: ${props =>
mapAlignmentToJustifyContent(props.alignment) || 'center'};
${props => `font-size: ${ props.fontSize||'unset' };` }
${props =>`color: ${cellColorOf(props)};` }
${props =>`background-color:${cellBgColorOf(props)};` }
${props => `font-weight: ${ props.fontWeight ||'normal' };` }
padding-left: 0.2em;
padding-right: 0.2em;
`

export const EllipsisCell = styled.div`
border-bottom: 1px solid #ccc;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-left: 1px solid #ccc;
user-select: none;
cursor: default;
${props => `text-align: ${props.alignment || 'center'}`};
${props => `font-size: ${props.fontSize || 'unset'};`}
${props => `color: ${cellColorOf(props)};`}
${props => `background-color:${cellBgColorOf(props)};`}
${props => `font-weight: ${props.fontWeight || 'normal'};`}
padding-left: 0.2em;
padding-right: 0.2em;
${props => `border-right: ${props.isLastInRow ? ' 1px solid #ccc' : 'unset'};`}
`

/* prettier-ignore */
Expand Down
6 changes: 4 additions & 2 deletions src/flexRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ const flexGridRenderer = ({
rowHeight,
})}
>
{rowHeaders.map((header, columnIndex) => (
{rowHeaders.map((header, columnIndex, all) => (
<FlexGridCell
render={cellRenderer}
editRender={editRenderer}
Expand All @@ -377,6 +377,7 @@ const flexGridRenderer = ({
columnIndex,
header,
data,
isLastInRow: all.length === columnIndex + 1,
})}
/>
))}
Expand Down Expand Up @@ -406,7 +407,7 @@ const flexGridRenderer = ({
rowHeight,
})}
>
{dataHeaders.map((header, columnIndex) => (
{dataHeaders.map((header, columnIndex, all) => (
<FlexGridCell
render={cellRenderer}
editRender={editRenderer}
Expand All @@ -415,6 +416,7 @@ const flexGridRenderer = ({
columnIndex: columnIndex + numOfFixedCols,
header,
data,
isLastInRow: all.length === columnIndex + 1,
})}
/>
))}
Expand Down
9 changes: 8 additions & 1 deletion src/virtualized/cellRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
SortIndicator,
inputCellEditRender,
dropdownEditRender,
EllipsisCell,
} from '../Components'
import R from 'ramda'
import pureComponent from '../AdvancedPureComponent'
Expand All @@ -19,6 +18,13 @@ export const Cell = BasicCell.extend`
border-bottom: 1px solid #ccc;
`

export const EllipsisCell = Cell.extend`
display: initial;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
`

export const ColHeaderBase = BasicColHeader.extend`
border-bottom: 1px solid #ccc;
`
Expand Down Expand Up @@ -100,6 +106,7 @@ export const defaultCellRender = ({
header: headers[columnIndex],
data,
style,
isLastInRow: headers.length === columnIndex + 1,
...rest,
})
if (cellProps.isEditing) {
Expand Down

0 comments on commit ed96d8d

Please sign in to comment.