|
@ -307,7 +307,7 @@ ItemSet.prototype._create = function(){ |
|
|
ItemSet.prototype.setOptions = function(options) { |
|
|
ItemSet.prototype.setOptions = function(options) { |
|
|
if (options) { |
|
|
if (options) { |
|
|
// copy all options that we know
|
|
|
// copy all options that we know
|
|
|
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'hide', 'snap', 'groupOrderSwap']; |
|
|
|
|
|
|
|
|
var fields = ['type', 'align', 'order', 'stack', 'selectable', 'multiselect', 'multiselectFiltersGroup', 'groupOrder', 'dataAttributes', 'template', 'groupTemplate', 'hide', 'snap', 'groupOrderSwap']; |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
util.selectiveExtend(fields, this.options, options); |
|
|
|
|
|
|
|
|
if ('orientation' in options) { |
|
|
if ('orientation' in options) { |
|
@ -1759,23 +1759,37 @@ ItemSet.prototype._onMultiSelectItem = function (event) { |
|
|
|
|
|
|
|
|
if (shiftKey && this.options.multiselect) { |
|
|
if (shiftKey && this.options.multiselect) { |
|
|
// select all items between the old selection and the tapped item
|
|
|
// select all items between the old selection and the tapped item
|
|
|
|
|
|
|
|
|
|
|
|
var itemGroup = this.itemsData.get(item.id).group; |
|
|
|
|
|
|
|
|
|
|
|
// when filtering get the group of the last selected item
|
|
|
|
|
|
var lastSelectedGroup = undefined; |
|
|
|
|
|
if (this.options.multiselectFiltersGroup) { |
|
|
|
|
|
if (selection.length > 0) { |
|
|
|
|
|
lastSelectedGroup = this.itemsData.get(selection[0]).group; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// determine the selection range
|
|
|
// determine the selection range
|
|
|
selection.push(item.id); |
|
|
|
|
|
|
|
|
if (!this.options.multiselectFiltersGroup || lastSelectedGroup == undefined || lastSelectedGroup == itemGroup) { |
|
|
|
|
|
selection.push(item.id); |
|
|
|
|
|
} |
|
|
var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions)); |
|
|
var range = ItemSet._getItemRange(this.itemsData.get(selection, this.itemOptions)); |
|
|
|
|
|
|
|
|
// select all items within the selection range
|
|
|
|
|
|
selection = []; |
|
|
|
|
|
for (var id in this.items) { |
|
|
|
|
|
if (this.items.hasOwnProperty(id)) { |
|
|
|
|
|
var _item = this.items[id]; |
|
|
|
|
|
var start = _item.data.start; |
|
|
|
|
|
var end = (_item.data.end !== undefined) ? _item.data.end : start; |
|
|
|
|
|
|
|
|
|
|
|
if (start >= range.min && |
|
|
|
|
|
end <= range.max && |
|
|
|
|
|
!(_item instanceof BackgroundItem)) { |
|
|
|
|
|
selection.push(_item.id); // do not use id but item.id, id itself is stringified
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.options.multiselectFiltersGroup || lastSelectedGroup == itemGroup) { |
|
|
|
|
|
// select all items within the selection range
|
|
|
|
|
|
selection = []; |
|
|
|
|
|
for (var id in this.items) { |
|
|
|
|
|
if (this.items.hasOwnProperty(id)) { |
|
|
|
|
|
var _item = this.items[id]; |
|
|
|
|
|
var start = _item.data.start; |
|
|
|
|
|
var end = (_item.data.end !== undefined) ? _item.data.end : start; |
|
|
|
|
|
|
|
|
|
|
|
if (start >= range.min && |
|
|
|
|
|
end <= range.max && |
|
|
|
|
|
(!this.options.multiselectFiltersGroup || lastSelectedGroup == this.itemsData.get(_item.id).group) && |
|
|
|
|
|
!(_item instanceof BackgroundItem)) { |
|
|
|
|
|
selection.push(_item.id); // do not use id but item.id, id itself is stringified
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|