OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2014 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 | 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 | 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 | 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 | 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 | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
8 --> | 8 --> |
9 | 9 |
10 <!-- | 10 <!-- |
(...skipping 18 matching lines...) Expand all Loading... |
29 <paper-item>Madeleine</paper-item> | 29 <paper-item>Madeleine</paper-item> |
30 </core-menu> | 30 </core-menu> |
31 </paper-dropdown> | 31 </paper-dropdown> |
32 </paper-dropdown-menu> | 32 </paper-dropdown-menu> |
33 | 33 |
34 This example renders a drop-down menu with 4 options. | 34 This example renders a drop-down menu with 4 options. |
35 | 35 |
36 @group Paper Elements | 36 @group Paper Elements |
37 @element paper-dropdown-menu | 37 @element paper-dropdown-menu |
38 @extends core-dropdown-base | 38 @extends core-dropdown-base |
| 39 @mixins Polymer.CoreFocusable https://github.com/polymer/core-focusable |
39 @status unstable | 40 @status unstable |
40 @homepage github.io | 41 @homepage github.io |
41 --> | 42 --> |
42 | 43 |
43 <!-- | 44 <!-- |
44 Fired when an item's selection state is changed. This event is fired both | 45 Fired when an item's selection state is changed. This event is fired both |
45 when an item is selected or deselected. The `isSelected` detail property | 46 when an item is selected or deselected. The `isSelected` detail property |
46 contains the selection state. | 47 contains the selection state. |
47 | 48 |
48 @event core-select | 49 @event core-select |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 -ms-user-select: none; | 87 -ms-user-select: none; |
87 -webkit-user-select: none; | 88 -webkit-user-select: none; |
88 user-select: none; | 89 user-select: none; |
89 cursor: pointer; | 90 cursor: pointer; |
90 padding: 0.5em 0 0.25em; | 91 padding: 0.5em 0 0.25em; |
91 margin: 0.75em 0; | 92 margin: 0.75em 0; |
92 border-bottom: 1px solid #757575; | 93 border-bottom: 1px solid #757575; |
93 outline: none; | 94 outline: none; |
94 } | 95 } |
95 | 96 |
96 #label, #arrow { | 97 #label:not(.selectedItem), #arrow { |
97 color: #757575; | 98 color: #757575; |
98 } | 99 } |
99 | 100 |
100 #label { | 101 #label { |
101 overflow: hidden; | 102 overflow: hidden; |
102 white-space: nowrap; | 103 white-space: nowrap; |
103 text-overflow: ellipsis; | 104 text-overflow: ellipsis; |
104 } | 105 } |
105 </style> | 106 </style> |
106 | 107 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 'core-select': 'selectAction' | 158 'core-select': 'selectAction' |
158 }, | 159 }, |
159 | 160 |
160 activateAction: function(e) { | 161 activateAction: function(e) { |
161 this.opened = false; | 162 this.opened = false; |
162 }, | 163 }, |
163 | 164 |
164 selectAction: function(e) { | 165 selectAction: function(e) { |
165 var detail = e.detail; | 166 var detail = e.detail; |
166 if (detail.isSelected) { | 167 if (detail.isSelected) { |
| 168 this.$.label.classList.add('selectedItem'); |
167 this.selectedItemLabel = detail.item.label || detail.item.textContent; | 169 this.selectedItemLabel = detail.item.label || detail.item.textContent; |
168 } else { | 170 } else { |
| 171 this.$.label.classList.remove('selectedItem'); |
169 this.selectedItemLabel = ''; | 172 this.selectedItemLabel = ''; |
170 } | 173 } |
171 } | 174 } |
172 | 175 |
173 }; | 176 }; |
174 | 177 |
175 Polymer.mixin2(p, Polymer.CoreFocusable); | 178 Polymer.mixin2(p, Polymer.CoreFocusable); |
176 Polymer(p); | 179 Polymer(p); |
177 | 180 |
178 })(); | 181 })(); |
179 | 182 |
180 </script> | 183 </script> |
181 </polymer-element> | 184 </polymer-element> |
OLD | NEW |