-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjviz-panel.html
244 lines (214 loc) · 6.95 KB
/
jviz-panel.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
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
<!--
@license
Copyright (c) 2016 The Jviz Project Authors. All rights reserved.
The Jviz Project is under the MIT License. See https://github.com/jviz/jviz/blob/dev/LICENSE
-->
<!-- Import dependencies -->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../jviz/jviz.html">
<link rel="import" href="../jviz-styles/jviz-styles.html">
<link rel="import" href="../jviz-loading/jviz-loading.html">
<link rel="import" href="../jviz-btn/jviz-btn.html">
<link rel="import" href="../jviz-icons/jviz-icons.html">
<!-- Panel module -->
<dom-module id="jviz-panel">
<template>
<style>
/* Variables and mixins */
:host
{
/* Padding */
--jviz-panel-padding: 6px;
}
/* Panel style */
:host
{
display: block;
width: calc(100% - var(--jviz-panel-padding) * 2);
font-family: var(--jviz-font-family);
font-size: var(--jviz-font-size);
color: var(--jviz-font-color);
border-radius: 5px;
background-color: var(--jviz-grey-2);
margin-bottom: 10px;
padding: var(--jviz-panel-padding);
}
/* Panel closed */
:host[closed] ::content .panel-body { display: none; }
:host[closed] ::content .panel-foot { display: none; }
/* Head content */
:host ::content .panel-head
{
display: block;
width: 100%;
height: 26px;
line-height: 26px;
@apply(--jviz-font);
}
/* Hide panel head */
:host[no-header] ::content .panel-head { display: none !important; }
/* Head arrow */
:host ::content .panel-head-arrow
{
display: none;
float: left;
margin-right: 5px;
margin-left: 0px;
cursor: pointer;
width: 26px;
height: 26px;
transition: all 0.3s;
background-color: var(--jviz-grey-1);
border-radius: 5px;
}
/* Head arrow hover */
:host ::content .panel-head-arrow:hover { background-color: var(--jviz-grey-0); }
/* Head arrow is active */
:host[arrow] ::content .panel-head-arrow { display: inline-block; }
/* Panel is closed */
:host[closed] ::content .panel-head-arrow { transform: rotate(180deg); }
/* Head info block */
:host ::content .panel-head-info
{
display: inline-block;
float: left;
height: 26px;
border-radius: 5px;
background-color: var(--jviz-grey-1);
@apply(--jviz-font);
font-size: 15px;
padding-left: 5px;
padding-right: 5px;
margin-right: 5px;
}
/* Head info title */
:host ::content .panel-head-info .panel-head-info-title
{
display: inline-block;
font-weight: bold;
margin-right: 3px;
margin-left: 3px;
}
/* Head info detail */
:host ::content .panel-head-info .panel-head-info-detail
{
display: inline-block;
font-weight: normal;
color: var(--jviz-navy-3);
font-size: 13px;
margin-right: 3px;
margin-left: 3px;
}
/* Head loading */
:host ::content .panel-head-loading
{
display: none;
width: 35px;
height: 18px;
margin-top: 0px;
margin-bottom: 0px;
padding-left: 8px;
padding-right: 8px;
padding-top: 8px;
}
/* Panel loading visible */
:host[loading] ::content .panel-head-loading { display: inline-block; }
/* Body content */
:host ::content .panel-body
{
display: block;
width: 100%;
margin-top: 5px;
margin-bottom: 0px;
}
/* Foot content */
:host ::content .panel-foot
{
display: block;
width: 100%;
border-top: 1px solid var(--jviz-grey-1);
color: var(--jviz-navy-3);
font-size: 14px;
padding-top: 5px;
margin-top: 5px;
}
/* Hide foot panel */
:host[no-footer] ::content .panel-foot { display: none !important; }
/* Apply to all button on the header */
:host ::content .panel-head jviz-btn
{
float: right !important;
height: 26px !important;
line-height: 26px !important;
margin-left: 5px !important;
font-size: 13px !important;
}
/* Panel top position */
:host[position="top"]
{
border-bottom-left-radius: 0px !important;
border-bottom-right-radius: 0px !important;
margin-bottom: 0px !important;
}
/* Panel middle position */
:host[position="middle"]
{
border-radius: 0px !important;
margin-bottom: 0px !important;
}
/* Panel bottom position */
:host[position="bottom"]
{
border-top-left-radius: 0px !important;
border-top-right-radius: 0px !important;
}
</style>
<!-- Head content -->
<div id="panel-head" class="panel-head">
<!-- Head arrow -->
<div id="panel-head-arrow" class="panel-head-arrow" on-tap="toggle">
<jviz-icons icon="chevron_up" size="26px" color="navy"></jviz-icons>
</div>
<!-- Head info block -->
<div id="panel-head-info" class="panel-head-info">
<!-- Panel title -->
<div id="panel-head-info-title" class="panel-head-info-title">{{ header }}</div>
<!-- Panel detail -->
<div id="panel-head-info-detail" class="panel-head-info-detail">{{ detail }}</div>
</div>
<!-- Head loading -->
<div id="panel-head-loading" class="panel-head-loading">
<jviz-loading color="navy" width="8px"></jviz-loading>
</div>
<!-- Head content -->
<content select="jviz-panel-head"></content>
</div>
<!-- Body content -->
<div id="panel-body" class="panel-body">
<content select="jviz-panel-body"></content>
</div>
<!-- Foot content -->
<div id="panel-foot" class="panel-foot">
<content select="jviz-panel-foot"></content>
</div>
</template>
</dom-module>
<!-- Panel logic -->
<script>
//Initialize the component
var jviz_panel = { is: 'jviz-panel' };
//Initialize the properties
jviz_panel.properties = {};
jviz_panel.properties.header = { type: String, value: '', reflectToAttribute: true };
jviz_panel.properties.detail = { type: String, value: '', reflectToAttribute: true };
jviz_panel.properties.arrow = { type: Boolean, value: true, reflectToAttribute: true };
jviz_panel.properties.closed = { type: Boolean, value: false, reflectToAttribute: true };
jviz_panel.properties.loading = { type: Boolean, value: false, reflectToAttribute: true };
jviz_panel.properties.noHeader = { type: Boolean, value: false, reflectToAttribute: true };
jviz_panel.properties.noFooter = { type: Boolean, value: false, reflectToAttribute: true };
jviz_panel.properties.position = { type: String, reflectToAttribute: true };
//Toggle panel closed
jviz_panel.toggle = function(){ this.closed = !this.closed; };
//Initialize the panel element
Polymer(jviz_panel);
</script>