Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-list/iron-list.html

Issue 2751523005: MD Settings: bump iron-list version. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --><html><head><link rel="import" href="../polymer/polymer.html"> 9 --><html><head><link rel="import" href="../polymer/polymer.html">
10 <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html "> 10 <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html ">
(...skipping 30 matching lines...) Expand all
41 display: block; 41 display: block;
42 height: 100vh; 42 height: 100vh;
43 display: flex; 43 display: flex;
44 flex-direction: column; 44 flex-direction: column;
45 } 45 }
46 46
47 iron-list { 47 iron-list {
48 flex: 1 1 auto; 48 flex: 1 1 auto;
49 } 49 }
50 </style> 50 </style>
51
52 <app-toolbar>App name</app-toolbar> 51 <app-toolbar>App name</app-toolbar>
53 <iron-list items="[[items]]"> 52 <iron-list items="[[items]]">
54 <template> 53 <template>
55 ... 54 <div>
55 ...
56 </div>
56 </template> 57 </template>
57 </iron-list> 58 </iron-list>
58 </template> 59 </template>
59 ``` 60 ```
60 #### Explicit size - [jsbin](http://jsbin.com/pibefo/edit?html,output) 61 #### Explicit size - [jsbin](http://jsbin.com/pibefo/edit?html,output)
61 ```html 62 ```html
62 <template is="x-list"> 63 <template is="x-list">
63 <style> 64 <style>
64 :host { 65 :host {
65 display: block; 66 display: block;
66 } 67 }
67 68
68 iron-list { 69 iron-list {
69 height: 100vh; /* don't use % values unless the parent element is sized. * / 70 height: 100vh; /* don't use % values unless the parent element is sized. * /
70 } 71 }
71 </style> 72 </style>
72 <iron-list items="[[items]]"> 73 <iron-list items="[[items]]">
73 <template> 74 <template>
74 ... 75 <div>
76 ...
77 </div>
75 </template> 78 </template>
76 </iron-list> 79 </iron-list>
77 </template> 80 </template>
78 ``` 81 ```
79 #### Main document scrolling - [jsbin](http://jsbin.com/cojuli/edit?html,output) 82 #### Main document scrolling - [jsbin](http://jsbin.com/cojuli/edit?html,output)
80 ```html 83 ```html
81 <head> 84 <head>
82 <style> 85 <style>
83 body { 86 body {
84 height: 100vh; 87 height: 100vh;
(...skipping 11 matching lines...) Expand all
96 99
97 iron-list { 100 iron-list {
98 /* add padding since the app-toolbar is fixed at the top */ 101 /* add padding since the app-toolbar is fixed at the top */
99 padding-top: 64px; 102 padding-top: 64px;
100 } 103 }
101 </style> 104 </style>
102 </head> 105 </head>
103 <body> 106 <body>
104 <template is="dom-bind"> 107 <template is="dom-bind">
105 <app-toolbar>App name</app-toolbar> 108 <app-toolbar>App name</app-toolbar>
106 <iron-list target="document" items="[[items]]"> 109 <iron-list scroll-target="document" items="[[items]]">
107 <template> 110 <template>
108 ... 111 <div>
112 ...
113 </div>
109 </template> 114 </template>
110 </iron-list> 115 </iron-list>
111 </template> 116 </template>
112 </body> 117 </body>
113 ``` 118 ```
114 119
120 `iron-list` must be given a `<template>` which contains exactly one element. In the examples
121 above we used a `<div>`, but you can provide any element (including custom eleme nts).
122
115 ### Template model 123 ### Template model
116 124
117 List item templates should bind to template models of the following structure: 125 List item templates should bind to template models of the following structure:
118 126
119 ```js 127 ```js
120 { 128 {
121 index: 0, // index in the item array 129 index: 0, // index in the item array
122 selected: false, // true if the current item is selected 130 selected: false, // true if the current item is selected
123 tabIndex: -1, // a dynamically generated tabIndex for focus management 131 tabIndex: -1, // a dynamically generated tabIndex for focus management
124 item: {} // user data corresponding to items[index] 132 item: {} // user data corresponding to items[index]
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 you might want to implement `IronResizableBehavior` or fire this event manually right 211 you might want to implement `IronResizableBehavior` or fire this event manually right
204 after the list became visible again. For example: 212 after the list became visible again. For example:
205 213
206 ```js 214 ```js
207 document.querySelector('iron-list').fire('iron-resize'); 215 document.querySelector('iron-list').fire('iron-resize');
208 ``` 216 ```
209 217
210 ### When should `<iron-list>` be used? 218 ### When should `<iron-list>` be used?
211 219
212 `iron-list` should be used when a page has significantly more DOM nodes than the ones 220 `iron-list` should be used when a page has significantly more DOM nodes than the ones
213 visible on the screen. e.g. the page has 500 nodes, but only 20 are visible at t he time. 221 visible on the screen. e.g. the page has 500 nodes, but only 20 are visible at a time.
214 This is why we refer to it as a `virtual` list. In this case, a `dom-repeat` wil l still 222 This is why we refer to it as a `virtual` list. In this case, a `dom-repeat` wil l still
215 create 500 nodes which could slow down the web app, but `iron-list` will only cr eate 20. 223 create 500 nodes which could slow down the web app, but `iron-list` will only cr eate 20.
216 224
217 However, having an `iron-list` does not mean that you can load all the data at o nce. 225 However, having an `iron-list` does not mean that you can load all the data at o nce.
218 Say, you have a million records in the database, you want to split the data into pages 226 Say you have a million records in the database, you want to split the data into pages
219 so you can bring a page at the time. The page could contain 500 items, and iron- list 227 so you can bring in a page at the time. The page could contain 500 items, and ir on-list
220 will only render 20. 228 will only render 20.
221 229
222 @group Iron Element 230 @group Iron Element
223 @element iron-list 231 @element iron-list
224 @demo demo/index.html 232 @demo demo/index.html
225 233
226 --> 234 -->
227 235
228 </head><body><dom-module id="iron-list"> 236 </head><body><dom-module id="iron-list">
229 <template> 237 <template>
230 <style> 238 <style>
231 :host { 239 :host {
232 display: block; 240 display: block;
233 position: relative;
234 } 241 }
235 242
236 @media only screen and (-webkit-max-device-pixel-ratio: 1) { 243 @media only screen and (-webkit-max-device-pixel-ratio: 1) {
237 :host { 244 :host {
238 will-change: transform; 245 will-change: transform;
239 } 246 }
240 } 247 }
241 248
242 #items { 249 #items {
243 @apply(--iron-list-items-container); 250 @apply(--iron-list-items-container);
244 position: relative; 251 position: relative;
245 } 252 }
246 253
247 :host(:not([grid])) #items > ::content > * { 254 :host(:not([grid])) #items > ::content > * {
248 width: 100%; 255 width: 100%;
249 }; 256 }
250 257
251 #items > ::content > * { 258 #items > ::content > * {
252 box-sizing: border-box; 259 box-sizing: border-box;
253 margin: 0; 260 margin: 0;
254 position: absolute; 261 position: absolute;
255 top: 0; 262 top: 0;
256 will-change: transform; 263 will-change: transform;
257 } 264 }
258 </style> 265 </style>
259 266
260 <array-selector id="selector" items="{{items}}" selected="{{selectedItems}}" selected-item="{{selectedItem}}"> 267 <array-selector id="selector" items="{{items}}" selected="{{selectedItems}}" selected-item="{{selectedItem}}">
261 </array-selector> 268 </array-selector>
262 269
263 <div id="items"> 270 <div id="items">
264 <content></content> 271 <content></content>
265 </div> 272 </div>
266 273
267 </template> 274 </template>
268 </dom-module> 275 </dom-module>
269 276
270 <script src="iron-list-extracted.js"></script></body></html> 277 <script src="iron-list-extracted.js"></script></body></html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698