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 | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE |
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS |
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS |
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 | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS |
8 --> | 8 --> |
9 | 9 |
10 <!-- | 10 <!-- |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 <template> | 55 <template> |
56 | 56 |
57 <style> | 57 <style> |
58 :host { | 58 :host { |
59 display: inline-block; | 59 display: inline-block; |
60 } | 60 } |
61 </style> | 61 </style> |
62 | 62 |
63 <paper-input-decorator id="decorator" label="{{label}}" floatingLabel="{{float
ingLabel}}" value="{{value}}" disabled?="{{disabled}}"> | 63 <paper-input-decorator id="decorator" label="{{label}}" floatingLabel="{{float
ingLabel}}" value="{{value}}" disabled?="{{disabled}}"> |
64 <input is="core-input" value="{{value}}" committedValue="{{committedValue}}"
on-change="{{changeAction}}" disabled?="{{disabled}}"> | 64 <input is="core-input" id="input" value="{{value}}" committedValue="{{commit
tedValue}}" on-change="{{changeAction}}" disabled?="{{disabled}}"> |
65 </paper-input-decorator> | 65 </paper-input-decorator> |
66 | 66 |
67 </template> | 67 </template> |
68 | 68 |
69 <script> | 69 <script> |
70 | 70 |
71 Polymer('paper-input', { | 71 Polymer('paper-input', { |
72 | 72 |
73 publish: { | 73 publish: { |
74 /** | 74 /** |
(...skipping 20 matching lines...) Expand all Loading... |
95 * Set to true to style the element as disabled. | 95 * Set to true to style the element as disabled. |
96 * | 96 * |
97 * @attribute disabled | 97 * @attribute disabled |
98 * @type boolean | 98 * @type boolean |
99 * @default false | 99 * @default false |
100 */ | 100 */ |
101 disabled: {value: false, reflect: true}, | 101 disabled: {value: false, reflect: true}, |
102 | 102 |
103 /** | 103 /** |
104 * The current value of the input. | 104 * The current value of the input. |
105 * | 105 * |
106 * @attribute value | 106 * @attribute value |
107 * @type String | 107 * @type String |
108 * @default '' | 108 * @default '' |
109 */ | 109 */ |
110 value: '', | 110 value: '', |
111 | 111 |
112 /** | 112 /** |
113 * The most recently committed value of the input. | 113 * The most recently committed value of the input. |
114 * | 114 * |
115 * @attribute committedValue | 115 * @attribute committedValue |
116 * @type String | 116 * @type String |
117 * @default '' | 117 * @default '' |
118 */ | 118 */ |
119 committedValue: '' | 119 committedValue: '' |
120 | 120 |
121 }, | 121 }, |
122 | 122 |
| 123 /** |
| 124 * Focuses the `input`. |
| 125 * |
| 126 * @method focus |
| 127 */ |
| 128 focus: function() { |
| 129 this.$.input.focus(); |
| 130 }, |
| 131 |
123 valueChanged: function() { | 132 valueChanged: function() { |
124 this.$.decorator.updateLabelVisibility(this.value); | 133 this.$.decorator.updateLabelVisibility(this.value); |
125 }, | 134 }, |
126 | 135 |
127 changeAction: function(e) { | 136 changeAction: function(e) { |
128 if (!window.ShadowDOMPolyfill) { | 137 // re-fire event that does not bubble across shadow roots |
129 // re-fire event that does not bubble across shadow roots | 138 this.fire('change', null, this); |
130 this.fire('change', null, this); | |
131 } | |
132 } | 139 } |
133 | 140 |
134 }); | 141 }); |
135 | 142 |
136 </script> | 143 </script> |
137 | 144 |
138 </polymer-element> | 145 </polymer-element> |
OLD | NEW |