73bcce88
luigser
COMPONENTS
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!doctype html>
<html>
<head>
<title>iron-list demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../../polymer/polymer.html">
|
73bcce88
luigser
COMPONENTS
|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<link rel="import" href="../../../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../iron-list.html">
<link rel="import" href="dummy-data.html">
<dom-module id="x-app">
<style>
:host {
display: block;
font-family: sans-serif;
@apply(--layout-horizontal);
}
iron-list {
@apply(--layout-flex);
|
73bcce88
luigser
COMPONENTS
|
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
|
}
.item {
display: block;
padding: 8px;
border-bottom: 1px solid gray;
@apply(--layout-horizontal);
}
.item img {
height: 40px;
width: 40px;
}
.picture {
@apply(--layout-vertical);
}
#about {
color: lightgray;
font-style: italic;
font-size: 0.8em;
}
#last {
font-weight: bold;
font-size: 1.2em;
}
.padded {
@apply(--layout-flex);
}
.padded > * {
padding: 8px;
}
#index {
text-align: center;
padding-top: 8px;
}
#options {
background: white;
border-radius: 10px;
border: 1px solid gray;
position: absolute;
top: 5px;
right: 5px;
z-index: 10;
padding: 5px;
}
#friends {
height: 20px;
}
</style>
<template>
<div id="options">
<input value="{{separator::input}}" style="width:20px;">
<label><input type="checkbox" checked="{{showing::change}}">Show friends</label>
</div>
<iron-list id="list1" items="{{data}}">
<template>
<div class="item">
<div class="picture">
<img src="{{pictureForItem(item)}}">
<div>{{item.index}}</div>
</div>
<div class="padded">
<div>
<input placeholder="name.last" value="{{item.name.last::input}}">
<span>{{separator}}</span>
<input placeholder="name.first" value="{{item.name.first::input}}">
</div>
<div>{{item.about}}</div>
<div id="friends">
<template is="dom-if" if="{{showing}}">
<span><strong>Friends:</strong></span>
<template is="dom-repeat" items="{{item.friends}}">
<span>{{item.name}}</span>
<span>{{separator}}</span>
</template>
</template>
</div>
</div>
</div>
</template>
</iron-list>
<iron-list id="list2" items="{{data}}">
<template>
<div class="item">
<div class="picture">
<img src="{{pictureForItem(item)}}">
<div>{{item.index}}</div>
</div>
<div class="padded">
<div>
<input placeholder="name.last" value="{{item.name.last::input}}">
<span>{{separator}}</span>
<input placeholder="name.first" value="{{item.name.first::input}}">
</div>
<div>{{item.about}}</div>
<div id="friends">
<template is="dom-if" if="{{showing}}">
<span><strong>Friends:</strong></span>
<template is="dom-repeat" items="{{item.friends}}">
<span>{{item.name}}</span>
<span>{{separator}}</span>
</template>
</template>
</div>
</div>
</div>
</template>
</iron-list>
</template>
</dom-module>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'x-app',
properties: {
data: {
value: window.dummyData
},
separator: {
value: '|'
},
showing: {
value: false
}
},
pictureForItem: function(item) {
return item.picture + '/' + item.guid.slice(0,6);
},
iconForItem: function(item) {
return item.gender == 'female' ? 'star' : 'star-outline';
}
});
});
</script>
<style is="custom-style">
|
c5169e0e
Renato De Donato
a new hope
|
191
|
x-app {
|
73bcce88
luigser
COMPONENTS
|
192
193
194
195
196
197
198
|
@apply(--layout-fit);
}
</style>
</head>
<body unresolved>
|
c5169e0e
Renato De Donato
a new hope
|
199
|
<x-app class="flex"></x-app>
|
73bcce88
luigser
COMPONENTS
|
200
201
202
|
</body>
</html>
|