aboutsummaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/themes/base/grid/grid.scss
blob: ed068a5efcb6a66f0ea1f9c69283f1162e5b2a03 (plain)
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
$v-grid-border: 1px solid #ddd !default;
$v-grid-cell-vertical-border: $v-grid-border !default;
$v-grid-cell-horizontal-border: $v-grid-cell-vertical-border !default;
$v-grid-cell-focused-border: 1px solid !default;
$v-grid-header-border: $v-grid-border !default;
$v-grid-footer-border: $v-grid-header-border !default;

$v-grid-row-height: round($v-font-size * 1.5) !default;
$v-grid-row-background-color: #fff !default;
$v-grid-row-stripe-background-color: darken($v-grid-row-background-color, 5%) !default;
$v-grid-row-selected-background-color: darken($v-grid-row-background-color, 25%) !default;
$v-grid-row-focused-background-color: null !default;

$v-grid-header-row-height: null !default;
$v-grid-header-font-size: $v-font-size !default;
$v-grid-header-background-color: $v-grid-row-background-color !default;

$v-grid-footer-row-height: $v-grid-header-row-height !default;
$v-grid-footer-font-size: $v-grid-header-font-size !default;
$v-grid-footer-background-color: $v-grid-header-background-color !default;

$v-grid-cell-padding-horizontal: 5px !default;

$v-grid-editor-background-color: $v-grid-row-background-color !default;


@import "../escalator/escalator";


@mixin base-grid($primaryStyleName: v-grid) {

  @include base-escalator($primaryStyleName: $primaryStyleName, $background-color: $v-grid-row-background-color);

  .#{$primaryStyleName} {
    outline: none;
  }

  .#{$primaryStyleName}-scroller-vertical,
  .#{$primaryStyleName}-scroller-horizontal {
    border: $v-grid-border;
  }

  .#{$primaryStyleName}-scroller-vertical {
    border-left: none;
  }

  .#{$primaryStyleName}-scroller-horizontal {
    border-top: none;
  }

  .#{$primaryStyleName}-tablewrapper {
    border: $v-grid-border;
  }

  // Common cell styles

  .#{$primaryStyleName}-cell {
    background-color: $v-grid-row-background-color;
    padding: 0 $v-grid-cell-padding-horizontal;
    line-height: $v-grid-row-height;
    text-overflow: ellipsis;

    > * {
      line-height: $v-line-height;
      vertical-align: middle;
    }

    // Force div elements to inline-blocks by default to enable vertical centering
    > div {
      display: inline-block;
    }

    &.frozen {
      @include box-shadow(1px 0 2px rgba(0,0,0,.1));
      border-right: $v-grid-cell-vertical-border;

      @if $v-grid-cell-vertical-border and $v-grid-cell-vertical-border != none {
        + th,
        + td {
          border-left: none;
        }
      }
    }
  }

  // Rows

  .#{$primaryStyleName}-row > td {
    border-left: $v-grid-cell-vertical-border;
    border-bottom: $v-grid-cell-horizontal-border;

    &:first-child {
      border-left: none;
    }
  }

  .#{$primaryStyleName}-row-stripe > td {
    background-color: $v-grid-row-stripe-background-color;
  }

  .#{$primaryStyleName}-row-selected > td {
    background: $v-grid-row-selected-background-color;
  }

  .#{$primaryStyleName}-row-focused > td {
    background-color: $v-grid-row-focused-background-color;
  }

  // Header

  .#{$primaryStyleName}-header {
    th {
      position: relative;
      background-color: $v-grid-header-background-color;
      font-size: $v-grid-header-font-size;
      font-weight: inherit;
      border-left: $v-grid-header-border;
      border-bottom: $v-grid-header-border;
      line-height: $v-grid-header-row-height;
      text-align: left;

      &:first-child {
        border-left: none;
      }
    }

    .sort-asc,
    .sort-desc {
      padding-right: round($v-grid-header-font-size * 1.2) + $v-grid-cell-padding-horizontal;

      &:after {
        font-family: FontAwesome, sans-serif;
        content: "\f0de" " " attr(sort-order);
        position: absolute;
        right: $v-grid-cell-padding-horizontal;
        font-size: round($v-grid-header-font-size * 0.85);
      }
    }

    .sort-desc:after {
      content: "\f0dd" " " attr(sort-order);
    }
  }

  // Footer

  .#{$primaryStyleName}-footer {
    td {
      background-color: $v-grid-footer-background-color;
      font-size: $v-grid-footer-font-size;
      font-weight: inherit;
      border-left: $v-grid-footer-border;
      border-top: $v-grid-footer-border;
      border-bottom: none;
      line-height: $v-grid-footer-row-height;

      &:first-child {
        border-left: none;
      }
    }
  }

  // Decorative elements

  .#{$primaryStyleName}-header-deco {
    border-top: $v-grid-header-border;
    border-right: $v-grid-header-border;
    background-color: $v-grid-header-background-color;
  }

  .#{$primaryStyleName}-footer-deco {
    border-bottom: $v-grid-footer-border;
    border-right: $v-grid-footer-border;
    background-color: $v-grid-footer-background-color;
  }

  .#{$primaryStyleName}-horizontal-scrollbar-deco {
    background-color: $v-grid-footer-background-color;
    border: $v-grid-footer-border;
    border-top: none;
  }

  // Focused cell style (common for all cells)

  .#{$primaryStyleName}-cell-focused {
    position: relative;

    &:before {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      border: $v-grid-cell-focused-border;
      display: none;
      pointer-events: none;
    }
    
    // IE 8-10 apply "pointer-events" only to SVG elements. 
    // Using an empty SVG instead of an empty text node makes IE
    // obey the "pointer-events: none" and forwards click events 
    // to the underlying element. The data decodes to:
    // <svg xmlns="http://www.w3.org/2000/svg"></svg>
    .ie8 &:before,
    .ie9 &:before,
    .ie10 &:before {
      content: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==);
    } 
  }

  .#{$primaryStyleName}:focus .#{$primaryStyleName}-cell-focused:before {
    display: block;
  }

  .#{$primaryStyleName}.v-disabled:focus .#{$primaryStyleName}-cell-focused:before {
    // Disabled Grid should not show cell focus outline
    display: none;
  }

  // Editor

  .#{$primaryStyleName}-editor {
    // TODO should be fixed in offset calculations
    margin-top: -1px;
    position: absolute;
    overflow-y: visible;
    background: $v-grid-editor-background-color;
    @include box-shadow(0 0 10px 1px rgba(0,0,0,.3));

    > div {
      position: absolute;
      @include box-sizing(border-box);
      border-left: $v-grid-cell-vertical-border;

      &:first-child {
        border-left: none;
      }

      .v-textfield,
      .v-datefield,
      .v-filterselect {
        min-width: 100%;
        max-width: 100%;
        min-height: 100%;
        max-height: 100%;
        border: none;
        border-radius: 0;
      }

      .v-textfield-focus,
      .v-filterselect-focus input {
        position: relative;
        z-index: 1;
      }
    }
  }

  .#{$primaryStyleName}-editor-save,
  .#{$primaryStyleName}-editor-cancel {
    position: absolute;
    // TODO remove the inline size from the widgets
    width: auto !important;
    height: auto !important;
  }

  // Renderers

  .#{$primaryStyleName}-cell > .v-progressbar {
    width: 100%;
  }
}