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 21 matching lines...) Expand all Loading... | |
| 32 properties: { | 32 properties: { |
| 33 /** | 33 /** |
| 34 * Whether or not the keyboard's input element should be numerical | 34 * Whether or not the keyboard's input element should be numerical |
| 35 * or password. | 35 * or password. |
| 36 */ | 36 */ |
| 37 enablePassword: { | 37 enablePassword: { |
| 38 type: Boolean, | 38 type: Boolean, |
| 39 value: false | 39 value: false |
| 40 }, | 40 }, |
| 41 | 41 |
| 42 /** | |
| 43 * Whether or not the keyboard's submit button should be shown. | |
| 44 */ | |
| 45 enableSubmitButton: { | |
| 46 type: Boolean, | |
| 47 value: false | |
| 48 }, | |
| 49 | |
| 42 /** The value stored in the keyboard's input element. */ | 50 /** The value stored in the keyboard's input element. */ |
| 43 value: { | 51 value: { |
| 44 type: String, | 52 type: String, |
| 45 notify: true, | 53 notify: true, |
| 46 value: '', | 54 value: '', |
| 47 observer: 'onPinValueChange_' | 55 observer: 'onPinValueChange_' |
| 48 } | 56 } |
| 49 }, | 57 }, |
| 50 | 58 |
| 51 /** | 59 /** |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 // +password will convert a string to a number or to NaN if that's not | 160 // +password will convert a string to a number or to NaN if that's not |
| 153 // possible. Number.isInteger will verify the value is not a NaN and that it | 161 // possible. Number.isInteger will verify the value is not a NaN and that it |
| 154 // does not contain decimals. | 162 // does not contain decimals. |
| 155 // This heuristic will fail for inputs like '1.0'. | 163 // This heuristic will fail for inputs like '1.0'. |
| 156 // | 164 // |
| 157 // Since we still support users entering their passwords through the PIN | 165 // Since we still support users entering their passwords through the PIN |
| 158 // keyboard, we swap the input box to rtl when we think it is a password | 166 // keyboard, we swap the input box to rtl when we think it is a password |
| 159 // (just numbers), if the document direction is rtl. | 167 // (just numbers), if the document direction is rtl. |
| 160 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); | 168 var enableRtl = (document.dir == 'rtl') && !Number.isInteger(+password); |
| 161 return enableRtl ? 'input-non-pin' : ''; | 169 return enableRtl ? 'input-non-pin' : ''; |
| 170 }, | |
| 171 | |
| 172 /** | |
| 173 * Computes if the submit button is visible. | |
| 174 * @private | |
|
jdufault
2016/07/21 23:36:36
Add @param doc for submitEnabled
sammiequon
2016/07/29 18:57:38
Done.
| |
| 175 */ | |
| 176 computeSubmitHiddenClass_: function(submitEnabled) { | |
| 177 return submitEnabled ? '' : 'submit-button-hidden'; | |
| 162 } | 178 } |
| 163 }); | 179 }); |
| OLD | NEW |