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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/paper-dropdown-menu/paper-dropdown-menu-light-extracted.js

Issue 1862213002: Roll third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete appearance_browsertest.js, result of a previous bad merge. Created 4 years, 8 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 (function() { 1 (function() {
2 'use strict'; 2 'use strict';
3 3
4 Polymer({ 4 Polymer({
5 is: 'paper-dropdown-menu', 5 is: 'paper-dropdown-menu-light',
6
7 /**
8 * Fired when the dropdown opens.
9 *
10 * @event paper-dropdown-open
11 */
12
13 /**
14 * Fired when the dropdown closes.
15 *
16 * @event paper-dropdown-close
17 */
18 6
19 behaviors: [ 7 behaviors: [
20 Polymer.IronButtonState, 8 Polymer.IronButtonState,
21 Polymer.IronControlState, 9 Polymer.IronControlState,
10 Polymer.PaperRippleBehavior,
22 Polymer.IronFormElementBehavior, 11 Polymer.IronFormElementBehavior,
23 Polymer.IronValidatableBehavior 12 Polymer.IronValidatableBehavior
24 ], 13 ],
25 14
26 properties: { 15 properties: {
27 /** 16 /**
28 * The derived "label" of the currently selected item. This value 17 * The derived "label" of the currently selected item. This value
29 * is the `label` property on the selected item if set, or else the 18 * is the `label` property on the selected item if set, or else the
30 * trimmed text content of the selected item. 19 * trimmed text content of the selected item.
31 */ 20 */
(...skipping 17 matching lines...) Expand all
49 }, 38 },
50 39
51 /** 40 /**
52 * The value for this element that will be used when submitting in 41 * The value for this element that will be used when submitting in
53 * a form. It is read only, and will always have the same value 42 * a form. It is read only, and will always have the same value
54 * as `selectedItemLabel`. 43 * as `selectedItemLabel`.
55 */ 44 */
56 value: { 45 value: {
57 type: String, 46 type: String,
58 notify: true, 47 notify: true,
59 readOnly: true 48 readOnly: true,
49 observer: '_valueChanged',
60 }, 50 },
61 51
62 /** 52 /**
63 * The label for the dropdown. 53 * The label for the dropdown.
64 */ 54 */
65 label: { 55 label: {
66 type: String 56 type: String
67 }, 57 },
68 58
69 /** 59 /**
70 * The placeholder for the dropdown. 60 * The placeholder for the dropdown.
71 */ 61 */
72 placeholder: { 62 placeholder: {
73 type: String 63 type: String
74 }, 64 },
75 65
76 /** 66 /**
77 * The error message to display when invalid.
78 */
79 errorMessage: {
80 type: String
81 },
82
83 /**
84 * True if the dropdown is open. Otherwise, false. 67 * True if the dropdown is open. Otherwise, false.
85 */ 68 */
86 opened: { 69 opened: {
87 type: Boolean, 70 type: Boolean,
88 notify: true, 71 notify: true,
89 value: false, 72 value: false,
90 observer: '_openedChanged' 73 observer: '_openedChanged'
91 }, 74 },
92 75
93 /** 76 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 value: 'right' 110 value: 'right'
128 }, 111 },
129 112
130 /** 113 /**
131 * The orientation against which to align the menu dropdown 114 * The orientation against which to align the menu dropdown
132 * vertically relative to the dropdown trigger. 115 * vertically relative to the dropdown trigger.
133 */ 116 */
134 verticalAlign: { 117 verticalAlign: {
135 type: String, 118 type: String,
136 value: 'top' 119 value: 'top'
120 },
121
122 hasContent: {
123 type: Boolean,
124 readOnly: true
137 } 125 }
138 }, 126 },
139 127
140 listeners: { 128 listeners: {
141 'tap': '_onTap' 129 'tap': '_onTap'
142 }, 130 },
143 131
144 keyBindings: { 132 keyBindings: {
145 'up down': 'open', 133 'up down': 'open',
146 'esc': 'close' 134 'esc': 'close'
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 _getValidity: function(_value) { 248 _getValidity: function(_value) {
261 return this.disabled || !this.required || (this.required && !!this.val ue); 249 return this.disabled || !this.required || (this.required && !!this.val ue);
262 }, 250 },
263 251
264 _openedChanged: function() { 252 _openedChanged: function() {
265 var openState = this.opened ? 'true' : 'false'; 253 var openState = this.opened ? 'true' : 'false';
266 var e = this.contentElement; 254 var e = this.contentElement;
267 if (e) { 255 if (e) {
268 e.setAttribute('aria-expanded', openState); 256 e.setAttribute('aria-expanded', openState);
269 } 257 }
270 } 258 },
259
260 _computeLabelClass: function(noLabelFloat, alwaysFloatLabel, hasContent) {
261 var cls = '';
262 if (noLabelFloat === true) {
263 return hasContent ? 'label-is-hidden' : '';
264 }
265
266 if (hasContent || alwaysFloatLabel === true) {
267 cls += ' label-is-floating';
268 }
269 return cls;
270 },
271
272 _valueChanged: function() {
273 // Only update if it's actually different.
274 if (this.$.input && this.$.input.textContent !== this.value) {
275 this.$.input.textContent = this.value;
276 }
277
278 if (this.value || this.value === 0 || this.value === false) {
279 this._setHasContent(true);
280 } else {
281 this._setHasContent(false);
282 }
283 },
271 }); 284 });
272 })(); 285 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698