| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 } else { | 66 } else { |
| 67 this.selected = value; | 67 this.selected = value; |
| 68 } | 68 } |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 multiChanged: function(multi) { | 71 multiChanged: function(multi) { |
| 72 this._selection.multi = multi; | 72 this._selection.multi = multi; |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 get _shouldUpdateSelection() { |
| 76 return this.selected != null || |
| 77 (this.selectedValues != null && this.selectedValues.length); |
| 78 }, |
| 79 |
| 75 _updateSelected: function() { | 80 _updateSelected: function() { |
| 76 if (this.multi) { | 81 if (this.multi) { |
| 77 this._selectMulti(this.selectedValues); | 82 this._selectMulti(this.selectedValues); |
| 78 } else { | 83 } else { |
| 79 this._selectSelected(this.selected); | 84 this._selectSelected(this.selected); |
| 80 } | 85 } |
| 81 }, | 86 }, |
| 82 | 87 |
| 83 _selectMulti: function(values) { | 88 _selectMulti: function(values) { |
| 84 this._selection.clear(); | 89 this._selection.clear(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 96 } else { | 101 } else { |
| 97 this._setSelectedItems([s]); | 102 this._setSelectedItems([s]); |
| 98 this._setSelectedItem(s); | 103 this._setSelectedItem(s); |
| 99 } | 104 } |
| 100 }, | 105 }, |
| 101 | 106 |
| 102 _toggleSelected: function(value) { | 107 _toggleSelected: function(value) { |
| 103 var i = this.selectedValues.indexOf(value); | 108 var i = this.selectedValues.indexOf(value); |
| 104 var unselected = i < 0; | 109 var unselected = i < 0; |
| 105 if (unselected) { | 110 if (unselected) { |
| 106 this.selectedValues.push(value); | 111 this.push('selectedValues',value); |
| 107 } else { | 112 } else { |
| 108 this.selectedValues.splice(i, 1); | 113 this.splice('selectedValues',i,1); |
| 109 } | 114 } |
| 110 this._selection.setItemSelected(this._valueToItem(value), unselected); | 115 this._selection.setItemSelected(this._valueToItem(value), unselected); |
| 111 } | 116 } |
| 112 }; | 117 }; |
| 113 | 118 |
| 114 /** @polymerBehavior */ | 119 /** @polymerBehavior */ |
| 115 Polymer.IronMultiSelectableBehavior = [ | 120 Polymer.IronMultiSelectableBehavior = [ |
| 116 Polymer.IronSelectableBehavior, | 121 Polymer.IronSelectableBehavior, |
| 117 Polymer.IronMultiSelectableBehaviorImpl | 122 Polymer.IronMultiSelectableBehaviorImpl |
| 118 ]; | 123 ]; |
| 119 | 124 |
| 120 </script> | 125 </script> |
| OLD | NEW |