-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaper-table-style.html
134 lines (118 loc) · 4.94 KB
/
paper-table-style.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../paper-styles/color.html">
<link rel="import" href="../paper-styles/default-theme.html">
<link rel="import" href="../paper-styles/typography.html">
<!--
This element is an helper style useful for creating responsive HTML table
Examples:
Import `paper-table-style.html` and include **paper-table-style** in the style of an element's definition.
```html
<dom-module id="app-table">
<template>
<style include="paper-table-style">
</style>
</template>
<table>
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Value11</td>
<td>Value12</td>
</tr>
<tr>
<td>Value21</td>
<td>Value22</td>
</tr>
</tbody>
</table>
</dom-module>
```
### Styling
Custom property | Description | Default
--------------------------------------------|------------------------------------------------------------|------------------
`--paper-table-style-row-height` | The row height. | 48px
`--paper-table-style-divider-color` | The divider color. | --divider-color
`--paper-table-style-height` | The height not scrollable of the table. | 150px
`--paper-table-style-scrollbar-width` | The width of the scrollbar. | 8px
`--paper-table-style-scrollbar-color` | The colour of the scrollbar. | --divider-color
Mixin | Description
--------------------------------------------|--------------------------------------------------------------------------
`--paper-table-style` | ...
`--paper-table-style-th` | ...
`--paper-table-style-td` | ...
@pseudoElement paper-table-style
@demo demo/index.html
-->
<dom-module id="paper-table-style">
<template>
<style>
:host {
@apply --paper-table-style;
}
table {
@apply --layout-flex;
@apply --layout-vertical;
@apply --layout-justified;
}
thead {
@apply --layout-flex;
}
:host-context([fixed-header]) tbody {
height: var(--paper-table-style-height, 150px);
overflow-y: scroll;
overflow-x: hidden;
}
:host-context([fixed-header]) tbody::-webkit-scrollbar {
padding-right: var(--paper-table-style-scrollbar-width, 8px);
}
:host-context([fixed-header]) thead {
padding-right: var(--paper-table-style-scrollbar-width, 8px);
}
:host-context([fixed-header]) tbody::-webkit-scrollbar {
width: var(--paper-table-style-scrollbar-width, 8px);
}
:host-context([fixed-header]) tbody::-webkit-scrollbar-track {
border-radius: var(--paper-table-style-scrollbar-border-radius, 2px);
}
:host-context([fixed-header]) tbody::-webkit-scrollbar-thumb {
border-radius: var(--paper-table-style-scrollbar-border-radius, 2px);
background-color: var(--paper-table-style-scrollbar-color, var(--divider-color));
}
tr {
@apply --layout-flex;
@apply --layout-horizontal;
}
th {
@apply --layout-flex;
@apply --layout-horizontal;
height: var(--paper-table-style-row-height, 48px);
padding: 0 var(--paper-table-style-gutter, 24px);
color: var(--secondary-text-color);
border-bottom: 1px solid var(--paper-table-style-divider-color, var(--divider-color));
@apply --paper-font-body2;
@apply --layout-center-center;
@apply --paper-table-style-th;
}
td {
@apply --layout-flex;
@apply --layout-horizontal;
height: var(--paper-table-style-row-height, 48px);
padding: 0 var(--paper-table-style-gutter, 24px);
border-bottom: 1px solid var(--paper-table-style-divider-color, var(--divider-color));
@apply --paper-font-body1;
@apply --layout-center-center;
@apply --paper-table-style-td;
}
th, td {
@apply --paper-font-common-nowrap;
min-width: 20px;
}
</style>
</template>
</dom-module>