| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 <iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax> | 60 <iron-ajax url="data.json" last-response="{{data}}" auto></iron-ajax> |
| 61 <iron-list items="[[data]]" as="item"> | 61 <iron-list items="[[data]]" as="item"> |
| 62 <template> | 62 <template> |
| 63 <div> | 63 <div> |
| 64 Name: <span>[[item.name]]</span> | 64 Name: <span>[[item.name]]</span> |
| 65 </div> | 65 </div> |
| 66 </template> | 66 </template> |
| 67 </iron-list> | 67 </iron-list> |
| 68 </template> | 68 </template> |
| 69 | 69 |
| 70 ### Styling |
| 71 |
| 72 Use the `--iron-list-items-container` mixin to style the container of items, e.g
. |
| 73 |
| 74 iron-list { |
| 75 --iron-list-items-container: { |
| 76 margin: auto; |
| 77 }; |
| 78 } |
| 79 |
| 70 ### Resizing | 80 ### Resizing |
| 71 | 81 |
| 72 `iron-list` lays out the items when it recives a notification via the `resize` e
vent. | 82 `iron-list` lays out the items when it recives a notification via the `iron-resi
ze` event. |
| 73 This event is fired by any element that implements `IronResizableBehavior`. | 83 This event is fired by any element that implements `IronResizableBehavior`. |
| 74 | 84 |
| 75 By default, elements such as `iron-pages`, `paper-tabs` or `paper-dialog` will t
rigger | 85 By default, elements such as `iron-pages`, `paper-tabs` or `paper-dialog` will t
rigger |
| 76 this event automatically. If you hide the list manually (e.g. you use `display:
none`) | 86 this event automatically. If you hide the list manually (e.g. you use `display:
none`) |
| 77 you might want to implement `IronResizableBehavior` or fire this event manually
right | 87 you might want to implement `IronResizableBehavior` or fire this event manually
right |
| 78 after the list became visible again. e.g. | 88 after the list became visible again. e.g. |
| 79 | 89 |
| 80 document.querySelector('iron-list').fire('resize'); | 90 document.querySelector('iron-list').fire('iron-resize'); |
| 81 | 91 |
| 82 | 92 |
| 83 @group Iron Element | 93 @group Iron Element |
| 84 @element iron-list | 94 @element iron-list |
| 85 @demo demo/index.html | 95 @demo demo/index.html Simple list |
| 96 @demo demo/selection.html Selection of items |
| 97 @demo demo/collapse.html Collapsable items |
| 86 --> | 98 --> |
| 87 | 99 |
| 88 </head><body><dom-module id="iron-list"> | 100 </head><body><dom-module id="iron-list"> |
| 89 <style> | |
| 90 | |
| 91 :host { | |
| 92 display: block; | |
| 93 } | |
| 94 | |
| 95 :host(.has-scroller) { | |
| 96 overflow: auto; | |
| 97 } | |
| 98 | |
| 99 :host(:not(.has-scroller)) { | |
| 100 position: relative; | |
| 101 } | |
| 102 | |
| 103 #items { | |
| 104 position: relative; | |
| 105 } | |
| 106 | |
| 107 #items > ::content > * { | |
| 108 width: 100%; | |
| 109 box-sizing: border-box; | |
| 110 position: absolute; | |
| 111 top: 0; | |
| 112 will-change: transform; | |
| 113 } | |
| 114 | |
| 115 </style> | |
| 116 <template> | 101 <template> |
| 102 <style> |
| 103 :host { |
| 104 display: block; |
| 105 } |
| 106 |
| 107 :host(.has-scroller) { |
| 108 overflow: auto; |
| 109 } |
| 110 |
| 111 :host(:not(.has-scroller)) { |
| 112 position: relative; |
| 113 } |
| 114 |
| 115 #items { |
| 116 @apply(--iron-list-items-container); |
| 117 position: relative; |
| 118 } |
| 119 |
| 120 #items > ::content > * { |
| 121 width: 100%; |
| 122 box-sizing: border-box; |
| 123 position: absolute; |
| 124 top: 0; |
| 125 will-change: transform; |
| 126 } |
| 127 </style> |
| 117 | 128 |
| 118 <array-selector id="selector" items="{{items}}" selected="{{selectedItems}}"
selected-item="{{selectedItem}}"> | 129 <array-selector id="selector" items="{{items}}" selected="{{selectedItems}}"
selected-item="{{selectedItem}}"> |
| 119 </array-selector> | 130 </array-selector> |
| 120 | 131 |
| 121 <div id="items"> | 132 <div id="items"> |
| 122 <content></content> | 133 <content></content> |
| 123 </div> | 134 </div> |
| 124 | 135 |
| 125 </template> | 136 </template> |
| 126 </dom-module> | 137 </dom-module> |
| 127 | 138 |
| 128 <script src="iron-list-extracted.js"></script></body></html> | 139 <script src="iron-list-extracted.js"></script></body></html> |
| OLD | NEW |