|
|
@@ -78,6 +78,17 @@ |
|
|
},
|
|
|
|
|
|
/**
|
|
|
+ * When `true`, multiple items may be selected at once (in this case,
|
|
|
+ * `selected` is an array of currently selected items). When `false`,
|
|
|
+ * only one item may be selected at a time.
|
|
|
+ */
|
|
|
+ multi: {
|
|
|
+ type: Boolean,
|
|
|
+ value: false,
|
|
|
+ observer: '_resetSelection'
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
* When `multi` is true, this is an array that contains any selected.
|
|
|
* When `multi` is false, this is the currently selected item, or `null`
|
|
|
* if no item is selected.
|
|
|
@@ -94,16 +105,6 @@ |
|
|
toggle: {
|
|
|
type: Boolean,
|
|
|
value: false
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * When `true`, multiple items may be selected at once (in this case,
|
|
|
- * `selected` is an array of currently selected items). When `false`,
|
|
|
- * only one item may be selected at a time.
|
|
|
- */
|
|
|
- multi: {
|
|
|
- type: Boolean,
|
|
|
- observer: '_resetSelection'
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -128,6 +129,13 @@ |
|
|
}
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * Returns whether the item is currently selected.
|
|
|
+ *
|
|
|
+ * @method isSelected
|
|
|
+ * @param {*} item Item from `items` array to test
|
|
|
+ * @return {boolean} Whether the item is selected
|
|
|
+ */
|
|
|
isSelected: function(item) {
|
|
|
if (this.multi) {
|
|
|
return this._selectedColl.getKey(item) !== undefined;
|
|
|
@@ -138,6 +146,9 @@ |
|
|
|
|
|
/**
|
|
|
* Deselects the given item if it is already selected.
|
|
|
+ *
|
|
|
+ * @method isSelected
|
|
|
+ * @param {*} item Item from `items` array to deselect
|
|
|
*/
|
|
|
deselect: function(item) {
|
|
|
if (this.multi) {
|
|
|
@@ -156,6 +167,9 @@ |
|
|
/**
|
|
|
* Selects the given item. When `toggle` is true, this will automatically
|
|
|
* deselect the item if already selected.
|
|
|
+ *
|
|
|
+ * @method isSelected
|
|
|
+ * @param {*} item Item from `items` array to select
|
|
|
*/
|
|
|
select: function(item) {
|
|
|
var icol = Polymer.Collection.get(this.items);
|
|
|
|
0 comments on commit
ca267a5