diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 00000000..f8b48885 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/bootstrap-multiselect/v15/.suo b/.vs/bootstrap-multiselect/v15/.suo new file mode 100644 index 00000000..dd941079 Binary files /dev/null and b/.vs/bootstrap-multiselect/v15/.suo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 00000000..803c6904 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/dist/js/bootstrap-multiselect.js b/dist/js/bootstrap-multiselect.js index 2a028b77..1245c4eb 100644 --- a/dist/js/bootstrap-multiselect.js +++ b/dist/js/bootstrap-multiselect.js @@ -53,13 +53,13 @@ factory(root.jQuery, root.ko); } })(this, function ($, ko) { - "use strict";// jshint ;_; + "use strict"; if (typeof ko !== 'undefined' && ko.bindingHandlers && !ko.bindingHandlers.multiselect) { ko.bindingHandlers.multiselect = { after: ['options', 'value', 'selectedOptions', 'enable', 'disable'], - init: function(element, valueAccessor, allBindings, viewModel, bindingContext) { + init: function (element, valueAccessor, allBindings, viewModel, bindingContext) { var $element = $(element); var config = ko.toJS(valueAccessor()); @@ -69,9 +69,9 @@ var options = allBindings.get('options'); if (ko.isObservable(options)) { ko.computed({ - read: function() { + read: function () { options(); - setTimeout(function() { + setTimeout(function () { var ms = $element.data('multiselect'); if (ms) ms.updateOriginalOptions();//Not sure how beneficial this is. @@ -90,9 +90,9 @@ var value = allBindings.get('value'); if (ko.isObservable(value)) { ko.computed({ - read: function() { + read: function () { value(); - setTimeout(function() { + setTimeout(function () { $element.multiselect('refresh'); }, 1); }, @@ -107,9 +107,9 @@ var selectedOptions = allBindings.get('selectedOptions'); if (ko.isObservable(selectedOptions)) { ko.computed({ - read: function() { + read: function () { selectedOptions(); - setTimeout(function() { + setTimeout(function () { $element.multiselect('refresh'); }, 1); }, @@ -155,12 +155,12 @@ } } - ko.utils.domNodeDisposal.addDisposeCallback(element, function() { + ko.utils.domNodeDisposal.addDisposeCallback(element, function () { $element.multiselect('destroy'); }); }, - update: function(element, valueAccessor, allBindings, viewModel, bindingContext) { + update: function (element, valueAccessor, allBindings, viewModel, bindingContext) { var $element = $(element); var config = ko.toJS(valueAccessor()); @@ -237,225 +237,12 @@ } Multiselect.prototype = { - - defaults: { - /** - * Default text function will either print 'None selected' in case no - * option is selected or a list of the selected options up to a length - * of 3 selected options. - * - * @param {jQuery} options - * @param {jQuery} select - * @returns {String} - */ - buttonText: function(options, select) { - if (this.disabledText.length > 0 - && (select.prop('disabled') || (options.length == 0 && this.disableIfEmpty))) { - - return this.disabledText; - } - else if (options.length === 0) { - return this.nonSelectedText; - } - else if (this.allSelectedText - && options.length === $('option', $(select)).length - && $('option', $(select)).length !== 1 - && this.multiple) { - - if (this.selectAllNumber) { - return this.allSelectedText + ' (' + options.length + ')'; - } - else { - return this.allSelectedText; - } - } - else if (this.numberDisplayed != 0 && options.length > this.numberDisplayed) { - return options.length + ' ' + this.nSelectedText; - } - else { - var selected = ''; - var delimiter = this.delimiterText; - - options.each(function() { - var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text(); - selected += label + delimiter; - }); - - return selected.substr(0, selected.length - this.delimiterText.length); - } - }, - /** - * Updates the title of the button similar to the buttonText function. - * - * @param {jQuery} options - * @param {jQuery} select - * @returns {@exp;selected@call;substr} - */ - buttonTitle: function(options, select) { - if (options.length === 0) { - return this.nonSelectedText; - } - else { - var selected = ''; - var delimiter = this.delimiterText; - - options.each(function () { - var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text(); - selected += label + delimiter; - }); - return selected.substr(0, selected.length - this.delimiterText.length); - } - }, - checkboxName: function(option) { - return false; // no checkbox name - }, - /** - * Create a label. - * - * @param {jQuery} element - * @returns {String} - */ - optionLabel: function(element){ - return $(element).attr('label') || $(element).text(); - }, - /** - * Create a class. - * - * @param {jQuery} element - * @returns {String} - */ - optionClass: function(element) { - return $(element).attr('class') || ''; - }, - /** - * Triggered on change of the multiselect. - * - * Not triggered when selecting/deselecting options manually. - * - * @param {jQuery} option - * @param {Boolean} checked - */ - onChange : function(option, checked) { - - }, - /** - * Triggered when the dropdown is shown. - * - * @param {jQuery} event - */ - onDropdownShow: function(event) { - - }, - /** - * Triggered when the dropdown is hidden. - * - * @param {jQuery} event - */ - onDropdownHide: function(event) { - - }, - /** - * Triggered after the dropdown is shown. - * - * @param {jQuery} event - */ - onDropdownShown: function(event) { - - }, - /** - * Triggered after the dropdown is hidden. - * - * @param {jQuery} event - */ - onDropdownHidden: function(event) { - - }, - /** - * Triggered on select all. - */ - onSelectAll: function() { - - }, - /** - * Triggered on deselect all. - */ - onDeselectAll: function() { - - }, - /** - * Triggered after initializing. - * - * @param {jQuery} $select - * @param {jQuery} $container - */ - onInitialized: function($select, $container) { - - }, - /** - * Triggered on filtering. - * - * @param {jQuery} $filter - */ - onFiltering: function($filter) { - - }, - enableHTML: false, - buttonClass: 'btn btn-default', - inheritClass: false, - buttonWidth: 'auto', - buttonContainer: '
', - dropRight: false, - dropUp: false, - selectedClass: 'active', - // Maximum height of the dropdown menu. - // If maximum height is exceeded a scrollbar will be displayed. - maxHeight: false, - includeSelectAllOption: false, - includeSelectAllIfMoreThan: 0, - selectAllText: ' Select all', - selectAllValue: 'multiselect-all', - selectAllName: false, - selectAllNumber: true, - selectAllJustVisible: true, - enableFiltering: false, - enableCaseInsensitiveFiltering: false, - enableFullValueFiltering: false, - enableClickableOptGroups: false, - enableCollapsibleOptGroups: false, - collapseOptGroupsByDefault: false, - filterPlaceholder: 'Search', - // possible options: 'text', 'value', 'both' - filterBehavior: 'text', - includeFilterClearBtn: true, - preventInputChangeEvent: false, - nonSelectedText: 'None selected', - nSelectedText: 'selected', - allSelectedText: 'All selected', - numberDisplayed: 3, - disableIfEmpty: false, - disabledText: '', - delimiterText: ', ', - includeResetOption: false, - includeResetDivider: false, - resetText: 'Reset', - templates: { - button: '', - ul: '', - filter: '
  • ', - filterClearBtn: '', - li: '
  • ', - divider: '
  • ', - liGroup: '
  • ', - resetButton: '
  • ' - } - }, - constructor: Multiselect, /** * Builds the container of the multiselect. */ - buildContainer: function() { + buildContainer: function () { this.$container = $(this.options.buttonContainer); this.$container.on('show.bs.dropdown', this.options.onDropdownShow); this.$container.on('hide.bs.dropdown', this.options.onDropdownHide); @@ -466,7 +253,7 @@ /** * Builds the button of the multiselect. */ - buildButton: function() { + buildButton: function () { this.$button = $(this.options.templates.button).addClass(this.options.buttonClass); if (this.$select.attr('class') && this.options.inheritClass) { this.$button.addClass(this.$select.attr('class')); @@ -482,9 +269,9 @@ // Manually add button width if set. if (this.options.buttonWidth && this.options.buttonWidth !== 'auto') { this.$button.css({ - 'width' : '100%', //this.options.buttonWidth, - 'overflow' : 'hidden', - 'text-overflow' : 'ellipsis' + 'width': '100%', //this.options.buttonWidth, + 'overflow': 'hidden', + 'text-overflow': 'ellipsis' }); this.$container.css({ 'width': this.options.buttonWidth @@ -503,7 +290,7 @@ /** * Builds the ul representing the dropdown menu. */ - buildDropdown: function() { + buildDropdown: function () { // Build ul. this.$ul = $(this.options.templates.ul); @@ -524,7 +311,7 @@ if (this.options.dropUp) { - var height = Math.min(this.options.maxHeight, $('option[data-role!="divider"]', this.$select).length*26 + $('option[data-role="divider"]', this.$select).length*19 + (this.options.includeSelectAllOption ? 26 : 0) + (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering ? 44 : 0)); + var height = Math.min(this.options.maxHeight, $('option[data-role!="divider"]', this.$select).length * 26 + $('option[data-role="divider"]', this.$select).length * 19 + (this.options.includeSelectAllOption ? 26 : 0) + (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering ? 44 : 0)); var moveCalc = height + 34; this.$ul.css({ @@ -543,9 +330,9 @@ * * Uses createDivider and createOptionValue to create the necessary options. */ - buildDropdownOptions: function() { + buildDropdownOptions: function () { - this.$select.children().each($.proxy(function(index, element) { + this.$select.children().each($.proxy(function (index, element) { var $element = $(element); // Support optgroups and options without a group simultaneously. @@ -575,7 +362,7 @@ // Bind the change event on the dropdown elements. $(this.$ul).off('change', 'li:not(.multiselect-group) input[type="checkbox"], li:not(.multiselect-group) input[type="radio"]'); - $(this.$ul).on('change', 'li:not(.multiselect-group) input[type="checkbox"], li:not(.multiselect-group) input[type="radio"]', $.proxy(function(event) { + $(this.$ul).on('change', 'li:not(.multiselect-group) input[type="checkbox"], li:not(.multiselect-group) input[type="radio"]', $.proxy(function (event) { var $target = $(event.target); var checked = $target.prop('checked') || false; @@ -653,25 +440,25 @@ this.$select.change(); this.updateButtonText(); - if(this.options.preventInputChangeEvent) { + if (this.options.preventInputChangeEvent) { return false; } }, this)); - $('li a', this.$ul).on('mousedown', function(e) { + $('li a', this.$ul).on('mousedown', function (e) { if (e.shiftKey) { // Prevent selecting text by Shift+click return false; } }); - $(this.$ul).on('touchstart click', 'li a', $.proxy(function(event) { + $(this.$ul).on('touchstart click', 'li a', $.proxy(function (event) { event.stopPropagation(); var $target = $(event.target); if (event.shiftKey && this.options.multiple) { - if($target.is("label")){ // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431) + if ($target.is("label")) { // Handles checkbox selection manually (see https://github.com/davidstutz/bootstrap-multiselect/issues/431) event.preventDefault(); $target = $target.find("input"); $target.prop("checked", !$target.prop("checked")); @@ -715,7 +502,7 @@ } // Remembers last clicked option - if($target.is("input") && !$target.closest("li").is(".multiselect-item")){ + if ($target.is("input") && !$target.closest("li").is(".multiselect-item")) { this.lastToggledInput = $target; } @@ -723,7 +510,7 @@ }, this)); // Keyboard support. - this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function(event) { + this.$container.off('keydown.multiselect').on('keydown.multiselect', $.proxy(function (event) { if ($('input[type="text"]', this.$container).is(':focus')) { return; } @@ -739,7 +526,7 @@ } var index = $items.index($items.filter(':focus')); - + // Navigation up. if (event.keyCode === 38 && index > 0) { index--; @@ -768,7 +555,7 @@ }, this)); if (this.options.enableClickableOptGroups && this.options.multiple) { - $("li.multiselect-group input", this.$ul).on("change", $.proxy(function(event) { + $("li.multiselect-group input", this.$ul).on("change", $.proxy(function (event) { event.stopPropagation(); var $target = $(event.target); @@ -793,7 +580,7 @@ } } - $.each($inputs, $.proxy(function(index, input) { + $.each($inputs, $.proxy(function (index, input) { var value = $(input).val(); var $option = this.getOptionByValue(value); @@ -826,13 +613,13 @@ } if (this.options.enableCollapsibleOptGroups && this.options.multiple) { - $("li.multiselect-group .caret-container", this.$ul).on("click", $.proxy(function(event) { + $("li.multiselect-group .caret-container", this.$ul).on("click", $.proxy(function (event) { var $li = $(event.target).closest('li'); var $inputs = $li.nextUntil("li.multiselect-group") - .not('.multiselect-filter-hidden'); + .not('.multiselect-filter-hidden'); var visible = true; - $inputs.each(function() { + $inputs.each(function () { visible = visible && !$(this).hasClass('multiselect-collapsible-hidden'); }); @@ -857,7 +644,7 @@ * * @param {jQuery} element */ - createOptionValue: function(element) { + createOptionValue: function (element) { var $element = $(element); if ($element.is(':selected')) { $element.prop('selected', true); @@ -932,7 +719,7 @@ * * @param {jQuery} element */ - createDivider: function(element) { + createDivider: function (element) { var $divider = $(this.options.templates.divider); this.$ul.append($divider); }, @@ -942,7 +729,7 @@ * * @param {jQuery} group */ - createOptgroup: function(group) { + createOptgroup: function (group) { var label = $(group).attr("label"); var value = $(group).attr("value"); var $li = $('
  • '); @@ -971,7 +758,7 @@ this.$ul.append($li); - $("option", group).each($.proxy(function($, group) { + $("option", group).each($.proxy(function ($, group) { this.createOptionValue(group); }, this)) }, @@ -980,7 +767,7 @@ * Build the reset. * */ - buildReset: function() { + buildReset: function () { if (this.options.includeResetOption) { // Check whether to add a divider after the reset. @@ -997,7 +784,7 @@ $('a', $resetButton).text(this.options.resetText); } - $('a', $resetButton).click($.proxy(function(){ + $('a', $resetButton).click($.proxy(function () { this.clearSelection(); }, this)); @@ -1010,7 +797,7 @@ * * Checks if a select all has already been created. */ - buildSelectAll: function() { + buildSelectAll: function () { if (typeof this.options.selectAllValue === 'number') { this.options.selectAllValue = this.options.selectAllValue.toString(); } @@ -1018,7 +805,7 @@ var alreadyHasSelectAll = this.hasSelectAll(); if (!alreadyHasSelectAll && this.options.includeSelectAllOption && this.options.multiple - && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) { + && $('option', this.$select).length > this.options.includeSelectAllIfMoreThan) { // Check whether to add a divider after the select all. if (this.options.includeSelectAllDivider) { @@ -1058,7 +845,7 @@ /** * Builds the filter. */ - buildFilter: function() { + buildFilter: function () { // Build filter if filtering OR case insensitive filtering is enabled and the number of options exceeds (or equals) enableFilterLength. if (this.options.enableFiltering || this.options.enableCaseInsensitiveFiltering) { @@ -1070,9 +857,9 @@ $('input', this.$filter).attr('placeholder', this.options.filterPlaceholder); // Adds optional filter clear button - if(this.options.includeFilterClearBtn) { + if (this.options.includeFilterClearBtn) { var clearBtn = $(this.options.templates.filterClearBtn); - clearBtn.on('click', $.proxy(function(event){ + clearBtn.on('click', $.proxy(function (event) { clearTimeout(this.searchTimeout); this.query = ''; @@ -1091,24 +878,24 @@ this.$ul.prepend(this.$filter); - this.$filter.val(this.query).on('click', function(event) { + this.$filter.val(this.query).on('click', function (event) { event.stopPropagation(); - }).on('input keydown', $.proxy(function(event) { + }).on('input keydown', $.proxy(function (event) { // Cancel enter key default behaviour if (event.which === 13) { - event.preventDefault(); - } + event.preventDefault(); + } // This is useful to catch "keydown" events after the browser has updated the control. clearTimeout(this.searchTimeout); - this.searchTimeout = this.asyncFunction($.proxy(function() { + this.searchTimeout = this.asyncFunction($.proxy(function () { if (this.query !== event.target.value) { this.query = event.target.value; var currentGroup, currentGroupVisible; - $.each($('li', this.$ul), $.proxy(function(index, element) { + $.each($('li', this.$ul), $.proxy(function (index, element) { var value = $('input', element).length > 0 ? $('input', element).val() : ""; var text = $('label', element).text(); @@ -1145,13 +932,13 @@ } // Toggle current element (group or group item) according to showElement boolean. - if(!showElement){ - $(element).css('display', 'none'); - $(element).addClass('multiselect-filter-hidden'); + if (!showElement) { + $(element).css('display', 'none'); + $(element).addClass('multiselect-filter-hidden'); } - if(showElement){ - $(element).css('display', 'block'); - $(element).removeClass('multiselect-filter-hidden'); + if (showElement) { + $(element).css('display', 'block'); + $(element).removeClass('multiselect-filter-hidden'); } // Differentiate groups and group items. @@ -1194,7 +981,7 @@ /** * Unbinds the whole plugin. */ - destroy: function() { + destroy: function () { this.$container.remove(); this.$select.show(); @@ -1209,8 +996,8 @@ */ refresh: function () { var inputs = {}; - $('li input', this.$ul).each(function() { - inputs[$(this).val()] = $(this); + $('li input', this.$ul).each(function () { + inputs[$(this).val()] = $(this); }); $('option', this.$select).each($.proxy(function (index, element) { @@ -1264,8 +1051,8 @@ * @param {Array} selectValues * @param {Boolean} triggerOnChange */ - select: function(selectValues, triggerOnChange) { - if(!$.isArray(selectValues)) { + select: function (selectValues, triggerOnChange) { + if (!$.isArray(selectValues)) { selectValues = [selectValues]; } @@ -1279,7 +1066,7 @@ var $option = this.getOptionByValue(value); var $checkbox = this.getInputByValue(value); - if($option === undefined || $checkbox === undefined) { + if ($option === undefined || $checkbox === undefined) { continue; } @@ -1330,8 +1117,8 @@ * @param {Array} deselectValues * @param {Boolean} triggerOnChange */ - deselect: function(deselectValues, triggerOnChange) { - if(!$.isArray(deselectValues)) { + deselect: function (deselectValues, triggerOnChange) { + if (!$.isArray(deselectValues)) { deselectValues = [deselectValues]; } @@ -1345,7 +1132,7 @@ var $option = this.getOptionByValue(value); var $checkbox = this.getInputByValue(value); - if($option === undefined || $checkbox === undefined) { + if ($option === undefined || $checkbox === undefined) { continue; } @@ -1384,21 +1171,21 @@ var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul); var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible'); - if(justVisible) { - $('input:enabled' , visibleLis).prop('checked', true); + if (justVisible) { + $('input:enabled', visibleLis).prop('checked', true); visibleLis.addClass(this.options.selectedClass); - $('input:enabled' , visibleLis).each($.proxy(function(index, element) { + $('input:enabled', visibleLis).each($.proxy(function (index, element) { var value = $(element).val(); var option = this.getOptionByValue(value); $(option).prop('selected', true); }, this)); } else { - $('input:enabled' , allLis).prop('checked', true); + $('input:enabled', allLis).prop('checked', true); allLis.addClass(this.options.selectedClass); - $('input:enabled' , allLis).each($.proxy(function(index, element) { + $('input:enabled', allLis).each($.proxy(function (index, element) { var value = $(element).val(); var option = this.getOptionByValue(value); $(option).prop('selected', true); @@ -1429,21 +1216,21 @@ var allLis = $("li:not(.divider):not(.disabled):not(.multiselect-group)", this.$ul); var visibleLis = $("li:not(.divider):not(.disabled):not(.multiselect-group):not(.multiselect-filter-hidden):not(.multiselect-collapisble-hidden)", this.$ul).filter(':visible'); - if(justVisible) { - $('input[type="checkbox"]:enabled' , visibleLis).prop('checked', false); + if (justVisible) { + $('input[type="checkbox"]:enabled', visibleLis).prop('checked', false); visibleLis.removeClass(this.options.selectedClass); - $('input[type="checkbox"]:enabled' , visibleLis).each($.proxy(function(index, element) { + $('input[type="checkbox"]:enabled', visibleLis).each($.proxy(function (index, element) { var value = $(element).val(); var option = this.getOptionByValue(value); $(option).prop('selected', false); }, this)); } else { - $('input[type="checkbox"]:enabled' , allLis).prop('checked', false); + $('input[type="checkbox"]:enabled', allLis).prop('checked', false); allLis.removeClass(this.options.selectedClass); - $('input[type="checkbox"]:enabled' , allLis).each($.proxy(function(index, element) { + $('input[type="checkbox"]:enabled', allLis).each($.proxy(function (index, element) { var value = $(element).val(); var option = this.getOptionByValue(value); $(option).prop('selected', false); @@ -1466,7 +1253,7 @@ * * Rebuilds the dropdown, the filter and the select all option. */ - rebuild: function() { + rebuild: function () { this.$ul.html(''); // Important to distinguish between radios and checkboxes. @@ -1498,7 +1285,7 @@ /** * The provided data will be used to build the dropdown. */ - dataprovider: function(dataprovider) { + dataprovider: function (dataprovider) { var groupCounter = 0; var $select = this.$select.empty(); @@ -1515,7 +1302,7 @@ value: option.value }); - forEach(option.children, function(subOption) { // add children option tags + forEach(option.children, function (subOption) { // add children option tags var attributes = { value: subOption.value, label: subOption.label || subOption.value, @@ -1525,10 +1312,10 @@ }; //Loop through attributes object and add key-value for each attribute - for (var key in subOption.attributes) { + for (var key in subOption.attributes) { attributes['data-' + key] = subOption.attributes[key]; - } - //Append original attributes + new data attributes to option + } + //Append original attributes + new data attributes to option $tag.append($('