<div class="rh-table-container">
<div class="rh-table-container-scroller" onscroll="setShadow()">
<table class="rh-table" id="rh-table">
<tr class="rh-table-row">
<th class="rh-table-header rh-table-header rh-table-header--dock">
<a class="rh-table-header-link" href="">Läkemedelsnamn</a>
<span class="rh-table-header-icon" onclick="sortByName()"></span>
</th>
<th class="rh-table-header">
<a class="rh-table-header-link" href="">Substans</a>
</th>
<th class="rh-table-header">
<a class="rh-table-header-link" href="">Indikation</a>
</th>
<th class="rh-table-header">
<a class="rh-table-header-link" href="">Införa eller avstå</a>
</th>
<th class="rh-table-header">
<a class="rh-table-header-link" href="">Regionalt beslut</a>
</th>
<th class="rh-table-header">
<a class="rh-table-header-link" href="">Rek. NT-råd</a>
</th>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Inituniv</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">guanfacin</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">ADHD</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Cinqaero</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">reslizumab</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Eosinofil astma</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Entresto</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">sakubitril</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Hjärtsvikt</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Jinarc</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">tolvaptan</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Autosomal dominant polycystisk njursjukdom</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Keytruda</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">pembrolizumba</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Icke-småcellig</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Keytruda</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">pembrolizumba</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Icke-småcellig</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Keytruda</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">pembrolizumba</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Urotelial cancer</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">Kyprolis (uppdat)</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">karfilzombi</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Multipelt myelom</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">Införa</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-07-21</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">2016-05-03</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
</table>
</div>
</div>
<div class="rh-table-container">
<div class="rh-table-container-scroller" onscroll="setShadow()">
<table class="rh-table" id="rh-table">
<tr class="rh-table-row">
<th class="rh-table-header rh-table-header {{#if modifier}} rh-table-header--{{ modifier }}{{/if}}">
<a class="rh-table-header-link" href="">{{text}}</a>
<span class="rh-table-header-icon" onclick="sortByName()"></span>
</th>
{{#each titles}}
<th class="rh-table-header">
<a class="rh-table-header-link" href="">{{this.name}}</a>
</th>
{{/each}}
</tr>
{{#each tableObjs}}
<tr class="rh-table-row">
<td class="rh-table-cell rh-table-cell--bold">
<a class="rh-table-cell-link" href="">{{this.name}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell" id="firstCell">
<a class="rh-table-cell-link" href="">{{this.substance}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">{{this.indication}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">{{this.introduce}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">{{this.decision}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
<td class="rh-table-cell">
<a class="rh-table-cell-link" href="">{{this.nt}}</a>
<span class="rh-table-cell-icon" onclick="expand()"></span>
</td>
</tr>
{{/each}}
</table>
</div>
</div>
{
"name": "rh-table",
"text": "Läkemedelsnamn",
"modifier": "dock",
"titles": [
{
"id": "1",
"name": "Substans"
},
{
"id": "2",
"name": "Indikation"
},
{
"id": "3",
"name": "Införa eller avstå"
},
{
"id": "4",
"name": "Regionalt beslut"
},
{
"id": "5",
"name": "Rek. NT-råd"
}
],
"tableObjs": [
{
"id": "0",
"name": "Inituniv",
"substance": "guanfacin",
"indication": "ADHD",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "1",
"name": "Cinqaero",
"substance": "reslizumab",
"indication": "Eosinofil astma",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "2",
"name": "Entresto",
"substance": "sakubitril",
"indication": "Hjärtsvikt",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "3",
"name": "Jinarc",
"substance": "tolvaptan",
"indication": "Autosomal dominant polycystisk njursjukdom",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "4",
"name": "Keytruda",
"substance": "pembrolizumba",
"indication": "Icke-småcellig",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "5",
"name": "Keytruda",
"substance": "pembrolizumba",
"indication": "Icke-småcellig",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "6",
"name": "Keytruda",
"substance": "pembrolizumba",
"indication": "Urotelial cancer",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
},
{
"id": "7",
"name": "Kyprolis (uppdat)",
"substance": "karfilzombi",
"indication": "Multipelt myelom",
"introduce": "Införa",
"decision": "2016-07-21",
"nt": "2016-05-03"
}
]
}
//$base2-lighter : #F5F8FB;
.rh-table-container {
max-width: 64em; //em(1000);
padding-left: 10.4em; //em(168);
position: relative;
&-scroller {
margin-left: $space-5; //em(19);
overflow-x: scroll;
overflow-y: visible;
border: $border-thin--standard $grey-light;
@include medium {
margin-left: 2.9em; //em(46);
}
@include large {
margin-left: 3.8em; //em(61);
}
}
}
.rh-table {
border-collapse: separate;
width: 100%;
border-spacing: 0;
overflow: auto;
&-header {
max-width: $space-56; //em(225);
background: $base1;
padding-top: $space-3; //em(14);
padding-bottom: $space-3; //em(14);
border-left: $border-thin--standard $grey-light;
white-space: nowrap;
&-icon {
float: right;
margin-top: .4em; //em(6);
padding-right: $space-2; //em(10);
cursor: pointer;
&:after {
margin-left: $space-2; //em(10);
padding: $space-1; //em(4);
background: $white;
border-radius: 50%;
font-family: $icon--font-family;
content: "\e842";
}
@include medium {
margin-top: $space-2; //em(8);
&:after {
padding: .4em; //em(6);
}
}
@include large {
margin-top: $space-2; //em(10);
&:after {
padding: $space-2; //em(8);
}
}
}
&--dock {
position:absolute;
left: 0;
top: 0;
min-width: 11.8em; //em(189);
max-width: $space-56;//em(225);
border: $border-thin--standard $grey-light;
@include medium {
min-width: 13.5em; //em(216);
max-width: 15.3em; //em(245);
}
@include large {
min-width: 14.4em; //em(231);
max-width: 16.8em; //em(270);
}
}
&-link {
float: left;
padding: $space-2; //em(10);
white-space: nowrap;
color: $white;
font-weight: bold;
text-decoration: none;
font-size: $p-small;
@include medium { font-size: $p-medium; }
@include large { font-size: $p-large; }
}
&-shadow {
box-shadow: $box-shadow--standard $color-shadow; //1px 2px 5px rgba(0, 0, 0, 0.5);
&-icon {
float: right;
padding-right: .6em; //em(10);
&:after {
margin-left: .6em; //em(10);
padding: $space-2; //em(8);
background: $white;
border-radius: 50%;
font-family: $icon--font-family;
content: "\e842";
font-size: $p-small;
@include medium { font-size: $p-medium; }
@include large { font-size: $p-large; }
}
}
}
@include medium {
max-width: $space-56; //em(225);
}
@include large {
max-width: $space-64; //em(270);
}
}
&-cell {
//vertical-align: middle!important;
vertical-align: middle;
max-width: $space-48; //em(175);
padding-top: .375em; //em(6);
padding-bottom: .375em; //em(6);
border-left: $border-thin--standard $grey-light;
border-top: $border-thin--standard $grey-light;
white-space: nowrap;
&-icon {
float: right;
padding-right: .6em; //em(10);
margin-top: .6em; //em(10);
display: none;
&:after {
margin-left: .6em; //em(10);
padding: $space-2; //em(8);
background: $base2-light;
border-radius: 50%;
font-family: $icon--font-family;
content: "\e89b";
}
}
&-link {
float: left;
padding: .6em; //em(10);
font-size: $p-small;
color: $black;
text-decoration: none;
white-space: nowrap;
@include medium { font-size: $p-medium; }
@include large { font-size: $p-large; }
}
&--bold {
position: absolute;
left: 0;
top: auto;
min-width: 11.8em; //em(189);
max-width: $space-56; //em(225);
padding-top: .375em; //em(6);
padding-bottom: .375em; //em(6);
border: $border-thin--standard $grey-light;
font-weight: bold;
background: inherit;
@include medium {
min-width: 13.5em; //em(216);
max-width: 15em; //em(245);
}
@include large {
min-width: 14.4em; //em(231);
max-width: 16.875em; //em(270);
}
}
&-shadow {
box-shadow: $box-shadow--standard $color-shadow; //1px 2px 5px rgba(0, 0, 0, 0.5);
&-icon {
float: right;
padding-right: .6em; //em(10);
&:after {
margin-left: .6em; //em(10);
border-radius: 50%;
/* padding-top: 8px; //em(8);
padding-right: 8px; //em(8);
padding-bottom: 8px; //em(8);
padding-left: 8px; //em(8); */
padding: $space-2;
background: $white;
font-family: $icon--font-family;
content: "\e8f9";
font-size: $p-small;
@include medium { font-size: $p-medium;}
@include large { font-size: $p-large;}
}
}
}
@include medium {
max-width: 15.3em; //em(245);
}
@include large {
max-width: 16.8em; //em(270);
}
}
&-row:nth-child(odd) {
background: $base2-lighter;
}
&-row:nth-child(even) {
background: $white;
}
&-row:last-child td {
border-bottom: $border-thin--standard $grey-light;
}
}
.show-icon {
.rh-table-cell {
&-link {
overflow: hidden;
text-overflow: ellipsis;
//max-width: 70%!important;
max-width: 70%;
/* @include medium { max-width: 75%!important; }
@include large { max-width: 80%!important; } */
@include medium { max-width: 75%; }
@include large { max-width: 80%; }
}
&-icon {
//display: block!important;
display: block;
margin-top: .375em; //em(6);
&:after {
padding: $space-1; //em(4);
}
@include medium {
margin-top: .6em; //em(10);
&:after {
padding: .375em; //em(6);
}
}
@include large {
margin-top: .6em; //em(10);
&:after {
padding: $space-2; //em(8);
}
}
}
}
}
.selected {
//max-width: none!important;
max-width: none;
.rh-table-cell {
&-link {
//max-width: none!important;
max-width: none;
}
&-icon {
//display: none!important;
display: none;
}
}
}
/*
::-webkit-scrollbar {
height: em(20);
width: em(50);
}
::-webkit-scrollbar-track {
background: $white;
background-clip: content-box;
border-top: 2px solid $white;
width: em(50);
}
::-webkit-scrollbar-thumb:horizontal {
background: $grey-base;
border-radius: em(10);
border: 3px solid transparent;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
background: $grey-dark;
border-radius: em(10);
border: 3px solid transparent;
background-clip: content-box;
}
*/
{
"name": "regionhalland/table",
"description": "Table",
"type": "styleguide-organism",
"license": "GPL-3.0",
"authors": [
{
"name": "Region Halland",
"email": "webbplatser@regionhalland.se"
}
],
"require": {}
}
window.onload = function () {
var table, rows, i, x, y;
table = document.getElementById("rh-table");
if(table){
rows = table.rows;
for (var i = 1, row; row = rows[i]; i++) {
for (var j = 0, col; col = row.cells[j]; j++) {
x = rows[i].getElementsByTagName("TD")[j];
if(x.innerText.length > 20) {
x.classList.add('show-icon');
}
}
}
}
}
function sortByName() {
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
table = document.getElementById("rh-table");
switching = true;
dir = "asc";
while (switching) {
switching = false;
rows = table.getElementsByTagName("TR");
for (i = 1; i < (rows.length - 1); i++) {
shouldSwitch = false;
x = rows[i].getElementsByTagName("TD")[1];
y = rows[i + 1].getElementsByTagName("TD")[1];
var xContent = (isNaN(x.innerHTML))
? (x.innerHTML.toLowerCase() === '-')
? 0 : x.innerHTML.toLowerCase()
: parseFloat(x.innerHTML);
var yContent = (isNaN(y.innerHTML))
? (y.innerHTML.toLowerCase() === '-')
? 0 : y.innerHTML.toLowerCase()
: parseFloat(y.innerHTML);
if (dir == "asc") {
if (xContent > yContent) {
shouldSwitch= true;
break;
}
} else if (dir == "desc") {
if (xContent < yContent) {
shouldSwitch= true;
break;
}
}
}
if (shouldSwitch) {
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
switchcount ++;
} else {
if (switchcount == 0 && dir == "asc") {
dir = "desc";
switching = true;
}
}
}
}
function expand() {
var rows = document.getElementById('rh-table').rows;
for (var row = 0; row < rows.length; row++) {
var cols = rows[row].cells;
if (2 >= 0 && 2 < cols.length) {
cols[2].classList.toggle("selected");
}
}
}
function setShadow() {
var rows = document.getElementById('rh-table').rows;
for (var row = 0; row < rows.length; row++) {
var cols = rows[row].cells;
if (0 >= 0 && 0 < cols.length) {
cols[0].classList.add("rh-table-cell--shadow");
}
}
}