| 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 /** 'add-printers-list' is the list of discovered printers. */ | 5 /** 'add-printers-list' is the list of discovered printers. */ |
| 6 Polymer({ | 6 Polymer({ |
| 7 is: 'add-printer-list', | 7 is: 'add-printer-list', |
| 8 | 8 |
| 9 properties: { | 9 properties: { |
| 10 /** @type {!Array<!CupsPrinterInfo>} */ | 10 /** @type {!Array<!CupsPrinterInfo>} */ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 this.$$('iron-dropdown').close(); | 79 this.$$('iron-dropdown').close(); |
| 80 this.$.searchIcon.hidden = true; | 80 this.$.searchIcon.hidden = true; |
| 81 this.$.dropdownIcon.hidden = false; | 81 this.$.dropdownIcon.hidden = false; |
| 82 | 82 |
| 83 this.selectedItem = event.model.item; | 83 this.selectedItem = event.model.item; |
| 84 this.searchTerm_ = ''; | 84 this.searchTerm_ = ''; |
| 85 this.$$('input').value = this.selectedItem; | 85 this.$$('input').value = this.selectedItem; |
| 86 }, | 86 }, |
| 87 | 87 |
| 88 /** @private */ | 88 /** @private */ |
| 89 onBlur_: function() { | 89 onChange_: function() { |
| 90 this.$.searchIcon.hidden = true; | 90 this.$.searchIcon.hidden = true; |
| 91 this.$.dropdownIcon.hidden = false; | 91 this.$.dropdownIcon.hidden = false; |
| 92 }, | 92 }, |
| 93 | 93 |
| 94 /** @private */ | 94 /** @private */ |
| 95 filterItems_: function(searchTerm) { | 95 filterItems_: function(searchTerm) { |
| 96 if (!searchTerm) | 96 if (!searchTerm) |
| 97 return null; | 97 return null; |
| 98 return function(item) { | 98 return function(item) { |
| 99 return item.toLowerCase().includes(searchTerm.toLowerCase()); | 99 return item.toLowerCase().includes(searchTerm.toLowerCase()); |
| 100 }; | 100 }; |
| 101 }, | 101 }, |
| 102 }); | 102 }); |
| 103 | 103 |
| 104 /** 'add-printer-dialog' is the template of the Add Printer dialog. */ | 104 /** 'add-printer-dialog' is the template of the Add Printer dialog. */ |
| 105 Polymer({ | 105 Polymer({ |
| 106 is: 'add-printer-dialog', | 106 is: 'add-printer-dialog', |
| 107 | 107 |
| 108 /** @private */ | 108 /** @private */ |
| 109 attached: function() { | 109 attached: function() { |
| 110 this.$.dialog.showModal(); | 110 this.$.dialog.showModal(); |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 close: function() { | 113 close: function() { |
| 114 this.$.dialog.close(); | 114 this.$.dialog.close(); |
| 115 }, | 115 }, |
| 116 }); | 116 }); |
| OLD | NEW |