OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> |
| 9 <link rel="import" href="../../../polymer/polymer.html"> |
| 10 <link rel="import" href="../../../iron-icons/iron-icons.html"> |
| 11 <link rel="import" href="../../../iron-icon/iron-icon.html"> |
| 12 <link rel="import" href="../../../paper-icon-button/paper-icon-button.html"> |
| 13 <link rel="import" href="../../../paper-item/paper-item.html"> |
| 14 <link rel="import" href="../../../paper-item/paper-item-body.html"> |
| 15 <link rel="import" href="../../../paper-styles/paper-styles.html"> |
| 16 <link rel="import" href="../../neon-animatable-behavior.html"> |
| 17 |
| 18 <dom-module id="list-view"> |
| 19 |
| 20 <style> |
| 21 |
| 22 :host { |
| 23 @apply(--layout-vertical); |
| 24 } |
| 25 |
| 26 .main { |
| 27 @apply(--layout-flex); |
| 28 @apply(--layout-scroll); |
| 29 } |
| 30 |
| 31 iron-icon { |
| 32 color: var(--google-grey-500); |
| 33 } |
| 34 |
| 35 </style> |
| 36 |
| 37 <template> |
| 38 |
| 39 <paper-toolbar class="medium-tall"> |
| 40 <paper-icon-button id="button" icon="arrow-back"></paper-icon-button> |
| 41 </paper-toolbar> |
| 42 |
| 43 <div class="main"> |
| 44 |
| 45 <template is="dom-repeat" items="[[data]]"> |
| 46 |
| 47 <paper-item> |
| 48 <paper-item-body two-line> |
| 49 <div>[[item.fileName]]</div> |
| 50 <div secondary>[[item.modifiedDate]]</div> |
| 51 </paper-item-body> |
| 52 <iron-icon icon="info"></iron-icon> |
| 53 </paper-item> |
| 54 |
| 55 </template> |
| 56 |
| 57 </div> |
| 58 |
| 59 </template> |
| 60 |
| 61 </dom-module> |
| 62 |
| 63 <script> |
| 64 |
| 65 Polymer({ |
| 66 |
| 67 is: 'list-view', |
| 68 |
| 69 behaviors: [ |
| 70 Polymer.NeonAnimatableBehavior |
| 71 ], |
| 72 |
| 73 listeners: { |
| 74 'click': '_onClick' |
| 75 }, |
| 76 |
| 77 properties: { |
| 78 |
| 79 data: { |
| 80 type: Array, |
| 81 value: function() { |
| 82 return []; |
| 83 } |
| 84 }, |
| 85 |
| 86 animationConfig: { |
| 87 type: Object, |
| 88 value: function() { |
| 89 return { |
| 90 'entry': [{ |
| 91 name: 'fade-in-animation', |
| 92 node: this.$.button |
| 93 }], |
| 94 |
| 95 'exit': [{ |
| 96 name: 'fade-out-animation', |
| 97 node: this.$.button |
| 98 }, { |
| 99 name: 'hero-animation', |
| 100 id: 'hero', |
| 101 fromPage: this |
| 102 }] |
| 103 }; |
| 104 } |
| 105 } |
| 106 |
| 107 }, |
| 108 |
| 109 _onClick: function(event) { |
| 110 var target = event.target; |
| 111 while (target !== this && !target._templateInstance) { |
| 112 target = target.parentNode; |
| 113 } |
| 114 |
| 115 // configure the page animation |
| 116 this.sharedElements = { |
| 117 'hero': target, |
| 118 }; |
| 119 |
| 120 this.fire('item-click', { |
| 121 item: target, |
| 122 }); |
| 123 } |
| 124 |
| 125 }); |
| 126 |
| 127 </script> |
OLD | NEW |