Skip to content

Commit

Permalink
Fixed layout and styling of table
Browse files Browse the repository at this point in the history
-Now using flexbox to make the layout more
 dynamic.
-Row selection of hover works as intended.
-Improved the way scrollbars are shown.

Issue: DEB-188, DEB-192
  • Loading branch information
Albert Backenhof authored and Albert Backenhof committed Apr 17, 2019
1 parent a6a6ef2 commit 05c25c7
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/headers-table/column-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ColumnHeader extends React.PureComponent {
const style = {
...baseCSS,
fontSize: `${14 + styling.headerOptions.fontSizeAdjustment}px`,
height: isMediumFontSize ? '45px' : '35px',
height: isMediumFontSize ? '43px' : '33px',
verticalAlign: 'middle'
};

Expand Down
2 changes: 1 addition & 1 deletion src/headers-table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const HeadersTable = ({ data, general, qlik, styling, isKpi }) => {
);
})}
</tr>
{hasSecondDimension && (
{!isKpi && hasSecondDimension && (
<tr>
{injectSeparators(dimension2, styling.useSeparatorColumns).map((dimensionEntry, index) => {
if (dimensionEntry.isSeparator) {
Expand Down
2 changes: 0 additions & 2 deletions src/headers-table/measurement-column-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const MeasurementColumnHeader = ({ baseCSS, general, hasSecondDimension, measure
}
const cellStyle = {
...baseCSS,
cursor: 'default',
fontSize: `${baseFontSize + fontSizeAdjustment}px`,
height: isMediumFontSize ? '45px' : '35px',
verticalAlign: 'middle'
Expand All @@ -40,7 +39,6 @@ const MeasurementColumnHeader = ({ baseCSS, general, hasSecondDimension, measure

const style = {
...baseCSS,
cursor: 'default',
fontSize: `${15 + fontSizeAdjustment}px`,
height: isMediumFontSize ? '90px' : '70px',
verticalAlign: 'middle'
Expand Down
90 changes: 61 additions & 29 deletions src/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,7 @@
background-color: #fff;
}

.fdim-cells:hover {
background-color: #808080 !important;
color: #fff;
}

tbody tr:hover {
tbody tr:hover td {
cursor: default;
background-color: #808080 !important;
color: #fff;
Expand All @@ -171,29 +166,50 @@
border: groove;
}

.root {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
height: 100%;
width: 100%;
}

.kpi-table .fdim-cells,
.data-table td {
line-height: 1em !important;
}

.kpi-table {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
flex: none;
width: @KpiTableWidth !important;
overflow: hidden !important;
height: 100%;
margin: 0;
padding: 0;
position: absolute;
top: 0;
left: 0;
border-right: 1px solid #fff;
box-shadow: 4px 2px 8px #e1e1e1;

.header-wrapper {
flex: none;
box-shadow: 4px 2px 8px #e1e1e1;
}

.row-wrapper {
height: calc(~"100% - 92px");
overflow: scroll;
position: absolute;
margin: 0;
margin-bottom: 8px;
padding: 0;
margin-top: 0;
box-shadow: 4px 2px 8px #e1e1e1;
min-height: 0; /* This is to make flex size-filling work */

/* Adapt for Edge */
@supports (-ms-ime-align: auto) {
margin-bottom: 16px;
}

/* Adapt for IE11 */
@media screen and (-ms-high-contrast: none) {
margin-bottom: 16px;
}
}
}

Expand All @@ -202,34 +218,50 @@
}

.data-table {
height: 100%;
width: calc(100% - 243px);
position: absolute;
margin-left: @KpiTableWidth + 13px;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
margin-left: 13px;
min-width: 0; /* This is to make flex size-filling work */

.header-wrapper {
flex: none;
overflow: scroll;
width: 100%;
margin-right: 8px;
}

.row-wrapper {
height: calc(~"100% - 92px");
width: 100%;
overflow: auto;
overflow: scroll;
margin: 0;
padding: 0;
margin-top: 0;
min-height: 0; /* This is to make flex size-filling work */

/* Style scrollbar for FF */
scrollbar-width: thin;
scrollbar-color: #d3d3d3 transparent;
}

/* Adapt for Edge */
@supports (-ms-ime-align: auto) {
.header-wrapper {
margin-right: 16px;
}
}

// Use overlay-scrollbars for webkit-browsers
@media screen and (-webkit-min-device-pixel-ratio: 0) {
.row-wrapper {
overflow: overlay;
/* Adapt for IE11 */
@media screen and (-ms-high-contrast: none) {
width: 100%;
height: 100%;

.header-wrapper {
margin-right: 16px;
}
}
}

// hide scrollbars
.kpi-table .header-wrapper,
.kpi-table .row-wrapper,
.data-table .header-wrapper {
// stylelint-disable-next-line property-no-unknown
scrollbar-width: none;
Expand Down
74 changes: 38 additions & 36 deletions src/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,50 @@ import DataTable from './data-table/index.jsx';
import { LinkedScrollWrapper, LinkedScrollSection } from './linked-scroll';

const Root = ({ state, qlik, editmodeClass }) => (
<LinkedScrollWrapper>
<div className={`kpi-table ${editmodeClass}`}>
<HeadersTable
data={state.data}
general={state.general}
isKpi
qlik={qlik}
styling={state.styling}
/>
<LinkedScrollSection linkVertical>
<DataTable
data={state.data}
general={state.general}
qlik={qlik}
renderData={false}
styling={state.styling}
/>
</LinkedScrollSection>
</div>
<div className={`data-table ${editmodeClass}`}>
<LinkedScrollSection linkHorizontal>
<div className="root">
<LinkedScrollWrapper>
<div className={`kpi-table ${editmodeClass}`}>
<HeadersTable
data={state.data}
general={state.general}
isKpi={false}
qlik={qlik}
styling={state.styling}
/>
</LinkedScrollSection>
<LinkedScrollSection
linkHorizontal
linkVertical
>
<DataTable
data={state.data}
general={state.general}
isKpi
qlik={qlik}
styling={state.styling}
/>
</LinkedScrollSection>
</div>
</LinkedScrollWrapper>
<LinkedScrollSection linkVertical>
<DataTable
data={state.data}
general={state.general}
qlik={qlik}
renderData={false}
styling={state.styling}
/>
</LinkedScrollSection>
</div>
<div className={`data-table ${editmodeClass}`}>
<LinkedScrollSection linkHorizontal>
<HeadersTable
data={state.data}
general={state.general}
isKpi={false}
qlik={qlik}
styling={state.styling}
/>
</LinkedScrollSection>
<LinkedScrollSection
linkHorizontal
linkVertical
>
<DataTable
data={state.data}
general={state.general}
qlik={qlik}
styling={state.styling}
/>
</LinkedScrollSection>
</div>
</LinkedScrollWrapper>
</div>
);

Root.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion stylelint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = {
'indentation': 2,
'length-zero-no-unit': true,
'max-empty-lines': 1,
'max-nesting-depth': 3,
'max-nesting-depth': 5,
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
'media-feature-name-case': 'lower',
Expand Down

0 comments on commit 05c25c7

Please sign in to comment.