|
127 | 127 | var that = this,
|
128 | 128 | name = $el.attr('name') || options.name || '';
|
129 | 129 |
|
130 |
| - options.single = $el.prop('multiple') ? false : true; |
| 130 | + options.singleSelect = $el.prop('multiple') ? false : true; |
131 | 131 |
|
132 | 132 | this.options = options;
|
133 | 133 |
|
|
143 | 143 | // restore class and title from select element
|
144 | 144 | this.$parent = $(sprintf(
|
145 | 145 | '<div class="ms-parent %s %s" %s/>',
|
146 |
| - options.single ? 'ms-parent-single' : 'ms-parent-multiple', |
| 146 | + options.singleSelect ? 'ms-parent-single' : 'ms-parent-multiple', |
147 | 147 | $el.attr('class') || '',
|
148 | 148 | sprintf('title="%s"', $el.attr('title'))));
|
149 | 149 |
|
|
206 | 206 | );
|
207 | 207 | }
|
208 | 208 |
|
209 |
| - if (this.options.selectAll && !this.options.single) { |
| 209 | + if (this.options.selectAll && !this.options.singleSelect) { |
210 | 210 | $ul.append([
|
211 | 211 | '<li class="ms-select-all">',
|
212 | 212 | '<label>',
|
|
273 | 273 | $elm = $(elm),
|
274 | 274 | classes = $elm.attr('class') || '',
|
275 | 275 | title = sprintf('title="%s"', $elm.attr('title')),
|
276 |
| - multiple = this.options.single ? 'single' : 'multiple', |
| 276 | + multiple = this.options.multiple ? 'multiple' : '', |
| 277 | + singleSelect = this.options.singleSelect ? 'single': '', |
277 | 278 | disabled,
|
278 |
| - type = this.options.single ? 'radio' : 'checkbox'; |
| 279 | + type = this.options.singleSelect ? 'radio' : 'checkbox'; |
279 | 280 |
|
280 | 281 | if ($elm.is('option')) {
|
281 | 282 | var value = $elm.val(),
|
|
290 | 291 | disabled = groupDisabled || $elm.prop('disabled');
|
291 | 292 |
|
292 | 293 | $el = $([
|
293 |
| - sprintf('<li class="%s %s" %s %s>', multiple, classes, title, style), |
| 294 | + sprintf('<li class="%s %s %s" %s %s>', multiple, singleSelect, classes, title, style), |
294 | 295 | sprintf('<label class="%s">', disabled ? 'disabled' : ''),
|
295 | 296 | sprintf('<input type="%s" %s%s%s%s%s>',
|
296 | 297 | type, this.selectItemName,
|
|
323 | 324 |
|
324 | 325 | $group.append([
|
325 | 326 | '<li class="group">',
|
326 |
| - sprintf('<label class="optgroup %s %s" data-group="%s">', disabled ? 'disabled' : '', this.options.hideOptgroupCheckboxes || this.options.single ? 'hide-control' : '', group), |
327 |
| - this.options.hideOptgroupCheckboxes || this.options.single ? '' : |
| 327 | + sprintf('<label class="optgroup %s %s" data-group="%s">', disabled ? 'disabled' : '', this.options.hideOptgroupCheckboxes || this.options.singleSelect ? 'hide-control' : '', group), |
| 328 | + this.options.hideOptgroupCheckboxes || this.options.singleSelect ? '' : |
328 | 329 | sprintf('<input type="checkbox" %s %s>',
|
329 | 330 | this.selectGroupName, disabled ? 'disabled="disabled"' : ''),
|
330 |
| - this.options.hideOptgroupCheckboxes || this.options.single ? '' : |
| 331 | + this.options.hideOptgroupCheckboxes || this.options.singleSelect ? '' : |
331 | 332 | '<span class="ms-control-indicator"></span>',
|
332 | 333 | label,
|
333 | 334 | '</label>',
|
|
451 | 452 | });
|
452 | 453 | });
|
453 | 454 | this.$selectItems.off('click').on('click', function () {
|
454 |
| - if (that.options.single && $(this).parents('li').hasClass('selected') && $(this).is(':checked')) { |
| 455 | + if (that.options.singleSelect && $(this).parents('li').hasClass('selected') && $(this).is(':checked')) { |
455 | 456 | if (that.options.isOpen && !that.options.keepOpen) that.close();
|
456 | 457 | return;
|
457 | 458 | }
|
|
460 | 461 | that.update();
|
461 | 462 | that.updateOptGroupSelect();
|
462 | 463 |
|
463 |
| - if (that.options.single) { |
| 464 | + if (that.options.singleSelect) { |
464 | 465 | var clickedVal = $(this).val();
|
465 | 466 | that.$allControlItems.filter(function() {
|
466 | 467 | return $(this).val() !== clickedVal;
|
|
477 | 478 | instance: that
|
478 | 479 | });
|
479 | 480 |
|
480 |
| - if (that.options.single && that.options.isOpen && !that.options.keepOpen) { |
| 481 | + if (that.options.singleSelect && that.options.isOpen && !that.options.keepOpen) { |
481 | 482 | that.close();
|
482 | 483 | }
|
483 | 484 | });
|
|
817 | 818 | selectAllDelimiter: ['[', ']'],
|
818 | 819 | minimumCountSelected: 3,
|
819 | 820 | ellipsis: false,
|
| 821 | + multiple: false, |
820 | 822 | multipleWidth: 80,
|
821 |
| - single: false, |
| 823 | + singleSelect: false, |
822 | 824 | filter: false,
|
823 | 825 | width: undefined,
|
824 | 826 | dropWidth: undefined,
|
|
0 commit comments