Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally | 7 * 'pin-keyboard' is a keyboard that can be used to enter PINs or more generally |
| 8 * numeric values. | 8 * numeric values. |
| 9 * | 9 * |
| 10 * Properties: | 10 * Properties: |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 }, | 40 }, |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Whether or not the keyboard's submit button should be shown. | 43 * Whether or not the keyboard's submit button should be shown. |
| 44 */ | 44 */ |
| 45 enableSubmitButton: { | 45 enableSubmitButton: { |
| 46 type: Boolean, | 46 type: Boolean, |
| 47 value: false | 47 value: false |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 /** | |
| 51 * Whether or not the keyboard's input has anything entered. | |
| 52 */ | |
| 53 hasContent: { | |
|
jdufault
2016/08/26 01:24:12
It doesn't look like this property ever gets updat
sammiequon
2016/08/26 19:56:38
Done.
| |
| 54 type: Boolean, | |
| 55 value: false | |
| 56 }, | |
| 57 | |
| 50 /** The value stored in the keyboard's input element. */ | 58 /** The value stored in the keyboard's input element. */ |
| 51 value: { | 59 value: { |
| 52 type: String, | 60 type: String, |
| 53 notify: true, | 61 notify: true, |
| 54 value: '', | 62 value: '', |
| 55 observer: 'onPinValueChange_' | 63 observer: 'onPinValueChange_' |
| 56 } | 64 } |
| 57 }, | 65 }, |
| 58 | 66 |
| 59 /** | 67 /** |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 | 128 |
| 121 // Enter pressed. | 129 // Enter pressed. |
| 122 if (event.keyCode == 13) { | 130 if (event.keyCode == 13) { |
| 123 this.firePinSubmitEvent_(); | 131 this.firePinSubmitEvent_(); |
| 124 event.preventDefault(); | 132 event.preventDefault(); |
| 125 return; | 133 return; |
| 126 } | 134 } |
| 127 }, | 135 }, |
| 128 | 136 |
| 129 /** | 137 /** |
| 130 * Changes the color of the submit button if PIN is ready. | 138 * Disables the submit and backspace button if nothing is entered. |
| 131 * @param {string} value | 139 * @param {string} value |
| 132 * @private | 140 * @private |
| 133 */ | 141 */ |
| 134 getSubmitClass_: function(value) { | 142 hasInput_: function(value) { |
| 135 return value.length > 0 ? 'ready-background' : ''; | 143 return value.length > 0; |
| 136 }, | 144 }, |
| 137 | 145 |
| 138 /** | 146 /** |
| 139 * Computes whether the input type for the pin input should be password or | 147 * Computes whether the input type for the pin input should be password or |
| 140 * numerical. | 148 * numerical. |
| 141 * @param {boolean} enablePassword | 149 * @param {boolean} enablePassword |
| 142 * @private | 150 * @private |
| 143 */ | 151 */ |
| 144 getInputType_: function(enablePassword) { | 152 getInputType_: function(enablePassword) { |
| 145 return enablePassword ? 'password' : 'number'; | 153 return enablePassword ? 'password' : 'number'; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 171 // (just numbers), if the document direction is rtl. | 179 // (just numbers), if the document direction is rtl. |
| 172 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); | 180 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); |
| 173 return enableRtl ? 'input-non-pin' : ''; | 181 return enableRtl ? 'input-non-pin' : ''; |
| 174 }, | 182 }, |
| 175 | 183 |
| 176 /** | 184 /** |
| 177 * Computes if the submit button is visible. | 185 * Computes if the submit button is visible. |
| 178 * @param {boolean} submitEnabled | 186 * @param {boolean} submitEnabled |
| 179 * @private | 187 * @private |
| 180 */ | 188 */ |
| 181 getSubmitHiddenClass_: function(submitEnabled) { | 189 getSubmitClass_: function(submitEnabled) { |
| 182 return submitEnabled ? '' : 'submit-button-hidden'; | 190 return submitEnabled ? '' : 'submit-button-hidden'; |
| 183 } | 191 } |
| 184 }); | 192 }); |
| OLD | NEW |