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

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

Issue 2314283002: Roll Polymer (Closed)
Patch Set: dep Created 4 years, 3 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 ">
11 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html "> 11 <link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html ">
12 <link rel="import" href="../iron-scroll-target-behavior/iron-scroll-target-behav ior.html"> 12 <link rel="import" href="../iron-scroll-target-behavior/iron-scroll-target-behav ior.html">
13 13
14 <!-- 14 <!--
15 15
16 `iron-list` displays a virtual, 'infinite' list. The template inside 16 `iron-list` displays a virtual, 'infinite' list. The template inside
17 the iron-list element represents the DOM to create for each list item. 17 the iron-list element represents the DOM to create for each list item.
18 The `items` property specifies an array of list item data. 18 The `items` property specifies an array of list item data.
19 19
20 For performance reasons, not every item in the list is rendered at once; 20 For performance reasons, not every item in the list is rendered at once;
21 instead a small subset of actual template elements *(enough to fill the viewport )* 21 instead a small subset of actual template elements *(enough to fill the viewport )*
22 are rendered and reused as the user scrolls. As such, it is important that all 22 are rendered and reused as the user scrolls. As such, it is important that all
23 state of the list template be bound to the model driving it, since the view may 23 state of the list template be bound to the model driving it, since the view may
24 be reused with a new model at any time. Particularly, any state that may change 24 be reused with a new model at any time. Particularly, any state that may change
25 as the result of a user interaction with the list item must be bound to the mode l 25 as the result of a user interaction with the list item must be bound to the mode l
26 to avoid view state inconsistency. 26 to avoid view state inconsistency.
27 27
28 __Important:__ `iron-list` must either be explicitly sized, or delegate scrollin g to an 28 ### Sizing iron-list
29
30 `iron-list` must either be explicitly sized, or delegate scrolling to an
29 explicitly sized parent. By "explicitly sized", we mean it either has an explici t 31 explicitly sized parent. By "explicitly sized", we mean it either has an explici t
30 CSS `height` property set via a class or inline style, or else is sized by other 32 CSS `height` property set via a class or inline style, or else is sized by other
31 layout means (e.g. the `flex` or `fit` classes). 33 layout means (e.g. the `flex` or `fit` classes).
32 34
35 #### Flexbox - [jsbin](http://jsbin.com/kokaki/edit?html,output)
36
37 ```html
38 <template is="x-list">
39 <style>
40 :host {
41 display: block;
42 height: 100vh;
43 display: flex;
44 flex-direction: column;
45 }
46
47 iron-list {
48 flex: 1 1 auto;
49 }
50 </style>
51
52 <app-toolbar>App name</app-toolbar>
53 <iron-list items="[[items]]">
54 <template>
55 ...
56 </template>
57 </iron-list>
58 </template>
59 ```
60 #### Explicit size - [jsbin](http://jsbin.com/pibefo/edit?html,output)
61 ```html
62 <template is="x-list">
63 <style>
64 :host {
65 display: block;
66 }
67
68 iron-list {
69 height: 100vh; /* don't use % values unless the parent element is sized. * /
70 }
71 </style>
72 <iron-list items="[[items]]">
73 <template>
74 ...
75 </template>
76 </iron-list>
77 </template>
78 ```
79 #### Main document scrolling - [jsbin](http://jsbin.com/cojuli/edit?html,output)
80 ```html
81 <head>
82 <style>
83 body {
84 height: 100vh;
85 margin: 0;
86 display: flex;
87 flex-direction: column;
88 }
89
90 app-toolbar {
91 position: fixed;
92 top: 0;
93 left: 0;
94 right: 0;
95 }
96
97 iron-list {
98 /* add padding since the app-toolbar is fixed at the top */
99 padding-top: 64px;
100 }
101 </style>
102 </head>
103 <body>
104 <template is="dom-bind">
105 <app-toolbar>App name</app-toolbar>
106 <iron-list target="document" items="[[items]]">
107 <template>
108 ...
109 </template>
110 </iron-list>
111 </template>
112 </body>
113 ```
114
33 ### Template model 115 ### Template model
34 116
35 List item templates should bind to template models of the following structure: 117 List item templates should bind to template models of the following structure:
36 118
37 ```js 119 ```js
38 { 120 {
39 index: 0, // index in the item array 121 index: 0, // index in the item array
40 selected: false, // true if the current item is selected 122 selected: false, // true if the current item is selected
41 tabIndex: -1, // a dynamically generated tabIndex for focus management 123 tabIndex: -1, // a dynamically generated tabIndex for focus management
42 item: {} // user data corresponding to items[index] 124 item: {} // user data corresponding to items[index]
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 </array-selector> 261 </array-selector>
180 262
181 <div id="items"> 263 <div id="items">
182 <content></content> 264 <content></content>
183 </div> 265 </div>
184 266
185 </template> 267 </template>
186 </dom-module> 268 </dom-module>
187 269
188 <script src="iron-list-extracted.js"></script></body></html> 270 <script src="iron-list-extracted.js"></script></body></html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698