Skip to content

Commit 6ca2656

Browse files
committed
Build 1.4.2
1 parent 513f95e commit 6ca2656

30 files changed

+260
-248
lines changed

dist/locale/multiple-select-en-US.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
33
*
4-
* @version v1.4.1
4+
* @version v1.4.2
55
* @homepage http://multiple-select.wenzhixin.net.cn
66
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
77
* @license MIT

dist/locale/multiple-select-es-ES.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
33
*
4-
* @version v1.4.1
4+
* @version v1.4.2
55
* @homepage http://multiple-select.wenzhixin.net.cn
66
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
77
* @license MIT

dist/locale/multiple-select-zh-CN.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
33
*
4-
* @version v1.4.1
4+
* @version v1.4.2
55
* @homepage http://multiple-select.wenzhixin.net.cn
66
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
77
* @license MIT

dist/locale/multiple-select-zh-TW.min.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
33
*
4-
* @version v1.4.1
4+
* @version v1.4.2
55
* @homepage http://multiple-select.wenzhixin.net.cn
66
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
77
* @license MIT

dist/multiple-select-es.js

+42-34
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes
748748
}
749749
});
750750

751-
var VERSION = '1.4.1';
751+
var VERSION = '1.4.2';
752752
var DEFAULTS = {
753753
name: '',
754754
placeholder: '',
@@ -2706,7 +2706,7 @@ var removeDiacritics = function removeDiacritics(str) {
27062706
};
27072707

27082708
function _templateObject26() {
2709-
var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2709+
var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
27102710

27112711
_templateObject26 = function _templateObject26() {
27122712
return data;
@@ -2746,7 +2746,7 @@ function _templateObject23() {
27462746
}
27472747

27482748
function _templateObject22() {
2749-
var data = _taggedTemplateLiteral(["[value=\"", "\"]"]);
2749+
var data = _taggedTemplateLiteral(["[", "][data-group=\"", "\"]"]);
27502750

27512751
_templateObject22 = function _templateObject22() {
27522752
return data;
@@ -2756,7 +2756,7 @@ function _templateObject22() {
27562756
}
27572757

27582758
function _templateObject21() {
2759-
var data = _taggedTemplateLiteral(["[", "][data-group=\"", "\"]"]);
2759+
var data = _taggedTemplateLiteral(["input[", "]:checked"]);
27602760

27612761
_templateObject21 = function _templateObject21() {
27622762
return data;
@@ -2766,7 +2766,7 @@ function _templateObject21() {
27662766
}
27672767

27682768
function _templateObject20() {
2769-
var data = _taggedTemplateLiteral(["input[", "]:checked"]);
2769+
var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
27702770

27712771
_templateObject20 = function _templateObject20() {
27722772
return data;
@@ -2786,7 +2786,7 @@ function _templateObject19() {
27862786
}
27872787

27882788
function _templateObject18() {
2789-
var data = _taggedTemplateLiteral(["[data-group=\"", "\"]"]);
2789+
var data = _taggedTemplateLiteral(["<span>", "</span>"]);
27902790

27912791
_templateObject18 = function _templateObject18() {
27922792
return data;
@@ -2796,7 +2796,7 @@ function _templateObject18() {
27962796
}
27972797

27982798
function _templateObject17() {
2799-
var data = _taggedTemplateLiteral(["<span>", "</span>"]);
2799+
var data = _taggedTemplateLiteral([" data-group=\"", "\""]);
28002800

28012801
_templateObject17 = function _templateObject17() {
28022802
return data;
@@ -2806,7 +2806,7 @@ function _templateObject17() {
28062806
}
28072807

28082808
function _templateObject16() {
2809-
var data = _taggedTemplateLiteral([" data-group=\"", "\""]);
2809+
var data = _taggedTemplateLiteral(["<input type=\"", "\" value=\"", "\" ", "", "", "", ">"]);
28102810

28112811
_templateObject16 = function _templateObject16() {
28122812
return data;
@@ -2816,7 +2816,7 @@ function _templateObject16() {
28162816
}
28172817

28182818
function _templateObject15() {
2819-
var data = _taggedTemplateLiteral(["<input type=\"", "\" value=\"", "\" ", "", "", "", ">"]);
2819+
var data = _taggedTemplateLiteral(["<label class=\"", "\">"]);
28202820

28212821
_templateObject15 = function _templateObject15() {
28222822
return data;
@@ -2826,7 +2826,7 @@ function _templateObject15() {
28262826
}
28272827

28282828
function _templateObject14() {
2829-
var data = _taggedTemplateLiteral(["<label class=\"", "\">"]);
2829+
var data = _taggedTemplateLiteral(["<li class=\"", " ", "\" ", " ", ">"]);
28302830

28312831
_templateObject14 = function _templateObject14() {
28322832
return data;
@@ -2836,7 +2836,7 @@ function _templateObject14() {
28362836
}
28372837

28382838
function _templateObject13() {
2839-
var data = _taggedTemplateLiteral(["<li class=\"", " ", "\" ", " ", ">"]);
2839+
var data = _taggedTemplateLiteral(["style=\"", "\""]);
28402840

28412841
_templateObject13 = function _templateObject13() {
28422842
return data;
@@ -2846,7 +2846,7 @@ function _templateObject13() {
28462846
}
28472847

28482848
function _templateObject12() {
2849-
var data = _taggedTemplateLiteral(["style=\"", "\""]);
2849+
var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " ", ">"]);
28502850

28512851
_templateObject12 = function _templateObject12() {
28522852
return data;
@@ -2856,7 +2856,7 @@ function _templateObject12() {
28562856
}
28572857

28582858
function _templateObject11() {
2859-
var data = _taggedTemplateLiteral(["<input type=\"checkbox\" ", " ", ">"]);
2859+
var data = _taggedTemplateLiteral(["<span ", "></span>"]);
28602860

28612861
_templateObject11 = function _templateObject11() {
28622862
return data;
@@ -2984,6 +2984,7 @@ function () {
29842984
this.initFilter();
29852985
this.initDrop();
29862986
this.initView();
2987+
this.options.onAfterCreate();
29872988
}
29882989
}, {
29892990
key: "initLocale",
@@ -3014,7 +3015,7 @@ function () {
30143015
var el = this.$el[0];
30153016
var name = el.getAttribute('name') || this.options.name || ''; // hide select element
30163017

3017-
this.$el = this.$el.hide(); // label element
3018+
this.$el.hide(); // label element
30183019

30193020
this.$label = this.$el.closest('label');
30203021

@@ -3061,8 +3062,6 @@ function () {
30613062
}
30623063
});
30633064
}
3064-
3065-
this.options.onAfterCreate();
30663065
}
30673066
}, {
30683067
key: "initData",
@@ -3080,7 +3079,16 @@ function () {
30803079
});
30813080
}
30823081
});
3083-
this.data = this.options.data;
3082+
this.data = this.options.data.map(function (it) {
3083+
if (typeof it === 'string' || typeof it === 'number') {
3084+
return {
3085+
text: it,
3086+
value: it
3087+
};
3088+
}
3089+
3090+
return it;
3091+
});
30843092
return;
30853093
}
30863094

@@ -3218,7 +3226,7 @@ function () {
32183226
this.$drop.find('.multiple').css('width', "".concat(this.options.multipleWidth, "px"));
32193227
this.$searchInput = this.$drop.find('.ms-search input');
32203228
this.$selectAll = this.$drop.find("input[".concat(this.selectAllName, "]"));
3221-
this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "]"));
3229+
this.$selectGroups = this.$drop.find("input[".concat(this.selectGroupName, "],span[").concat(this.selectGroupName, "]"));
32223230
this.$selectItems = this.$drop.find("input[".concat(this.selectItemName, "]:enabled"));
32233231
this.$disableItems = this.$drop.find("input[".concat(this.selectItemName, "]:disabled"));
32243232
this.$noResults = this.$drop.find('.ms-no-results');
@@ -3244,22 +3252,22 @@ function () {
32443252
var _style = _customStyle ? sprintf(_templateObject9(), s)(_customStyle) : '';
32453253

32463254
var html = [];
3247-
html.push(["<li class=\"group ".concat(classes, "\" ").concat(_style, ">"), sprintf(_templateObject10(), s, s)(row.disabled ? 'disabled' : '', row.group), this.options.hideOptgroupCheckboxes || this.options.single ? '' : sprintf(_templateObject11(), s, s)(this.selectGroupName, row.disabled ? 'disabled="disabled"' : ''), row.label, '</label>', '</li>'].join(''));
3255+
html.push(["<li class=\"group ".concat(classes, "\" ").concat(_style, ">"), sprintf(_templateObject10(), s, s)(row.disabled ? 'disabled' : '', row.group), this.options.hideOptgroupCheckboxes || this.options.single ? sprintf(_templateObject11(), s)(this.selectGroupName) : sprintf(_templateObject12(), s, s)(this.selectGroupName, row.disabled ? 'disabled="disabled"' : ''), row.label, '</label>', '</li>'].join(''));
32483256
html.push(row.children.map(function (child) {
32493257
return _this6.initListItem(child, 1);
32503258
}).join(''));
32513259
return html.join('');
32523260
}
32533261

32543262
var customStyle = this.options.styler(row);
3255-
var style = customStyle ? sprintf(_templateObject12(), s)(customStyle) : '';
3263+
var style = customStyle ? sprintf(_templateObject13(), s)(customStyle) : '';
32563264
classes += row.classes || '';
32573265

32583266
if (level && this.options.single) {
32593267
classes += "option-level-".concat(level, " ");
32603268
}
32613269

3262-
return [sprintf(_templateObject13(), s, s, s, s)(multiple, classes, title, style), sprintf(_templateObject14(), s)(row.disabled ? 'disabled' : ''), sprintf(_templateObject15(), s, s, s, s, s, s)(type, row.value, this.selectItemName, row.selected ? ' checked="checked"' : '', row.disabled ? ' disabled="disabled"' : '', sprintf(_templateObject16(), s)(row.group)), sprintf(_templateObject17(), s)(row.text), '</label>', '</li>'].join('');
3270+
return [sprintf(_templateObject14(), s, s, s, s)(multiple, classes, title, style), sprintf(_templateObject15(), s)(row.disabled ? 'disabled' : ''), sprintf(_templateObject16(), s, s, s, s, s, s)(type, row.value, this.selectItemName, row.selected ? ' checked="checked"' : '', row.disabled ? ' disabled="disabled"' : '', sprintf(_templateObject17(), s)(row.group)), sprintf(_templateObject18(), s)(row.text), '</label>', '</li>'].join('');
32633271
}
32643272
}, {
32653273
key: "initView",
@@ -3277,6 +3285,7 @@ function () {
32773285
}
32783286

32793287
this.$parent.css('width', this.options.width || computedWidth);
3288+
this.$el.show().addClass('ms-offscreen');
32803289
}
32813290
}, {
32823291
key: "events",
@@ -3366,7 +3375,7 @@ function () {
33663375

33673376
var $items = _this7.$selectItems.filter(':visible');
33683377

3369-
var $children = $items.filter(sprintf(_templateObject18(), s)(group));
3378+
var $children = $items.filter(sprintf(_templateObject19(), s)(group));
33703379
var checked = $children.length !== $children.filter(':checked').length;
33713380
$children.prop('checked', checked);
33723381

@@ -3566,7 +3575,7 @@ function () {
35663575

35673576
$.each(this.$selectGroups, function (i, val) {
35683577
var group = $(val).parent()[0].getAttribute('data-group');
3569-
var $children = $items.filter(sprintf(_templateObject19(), s)(group));
3578+
var $children = $items.filter(sprintf(_templateObject20(), s)(group));
35703579
$(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
35713580
});
35723581
}
@@ -3598,19 +3607,19 @@ function () {
35983607

35993608
var texts = [];
36003609
var values = [];
3601-
this.$drop.find(sprintf(_templateObject20(), s)(this.selectItemName)).each(function (i, el) {
3610+
this.$drop.find(sprintf(_templateObject21(), s)(this.selectItemName)).each(function (i, el) {
36023611
texts.push($(el).next()[type === 'html' ? 'html' : 'text']());
36033612
values.push($(el).val());
36043613
});
36053614

3606-
if (type === 'text' && this.$selectGroups.length) {
3615+
if (type === 'text' && this.$selectGroups.length && !this.options.single) {
36073616
texts = [];
36083617
this.$selectGroups.each(function (i, el) {
36093618
var html = [];
36103619
var text = $.trim($(el).parent().text());
36113620
var group = $(el).parent().data('group');
36123621

3613-
var $children = _this8.$drop.find(sprintf(_templateObject21(), s, s)(_this8.selectItemName, group));
3622+
var $children = _this8.$drop.find(sprintf(_templateObject22(), s, s)(_this8.selectItemName, group));
36143623

36153624
var $selected = $children.filter(':checked');
36163625

@@ -3621,7 +3630,7 @@ function () {
36213630
html.push('[');
36223631
html.push(text);
36233632

3624-
if ($children.length > $selected.length) {
3633+
if ($children.length >= $selected.length) {
36253634
var list = [];
36263635
$selected.each(function (j, elem) {
36273636
list.push($(elem).parent().text());
@@ -3644,9 +3653,9 @@ function () {
36443653
this.$selectItems.prop('checked', false);
36453654
this.$disableItems.prop('checked', false);
36463655
$.each(values, function (i, value) {
3647-
_this9.$selectItems.filter(sprintf(_templateObject22(), s)(value)).prop('checked', true);
3656+
_this9.$selectItems.filter(sprintf(_templateObject23(), s)(value)).prop('checked', true);
36483657

3649-
_this9.$disableItems.filter(sprintf(_templateObject23(), s)(value)).prop('checked', true);
3658+
_this9.$disableItems.filter(sprintf(_templateObject24(), s)(value)).prop('checked', true);
36503659
});
36513660
this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);
36523661
$.each(this.$selectGroups, function (i, val) {
@@ -3686,8 +3695,8 @@ function () {
36863695
}, {
36873696
key: "_check",
36883697
value: function _check(value, checked) {
3689-
this.$selectItems.filter(sprintf(_templateObject24(), s)(value)).prop('checked', checked);
3690-
this.$disableItems.filter(sprintf(_templateObject25(), s)(value)).prop('checked', checked);
3698+
this.$selectItems.filter(sprintf(_templateObject25(), s)(value)).prop('checked', checked);
3699+
this.$disableItems.filter(sprintf(_templateObject26(), s)(value)).prop('checked', checked);
36913700
this.update();
36923701
this.updateOptGroupSelect(true);
36933702
this.updateSelectAll(true, true);
@@ -3784,9 +3793,8 @@ function () {
37843793

37853794
_this10.$selectItems.filter("[data-group=\"".concat(group, "\"]")).closest('li')[func]();
37863795
} else {
3787-
var $items = _this10.$selectItems.filter(':visible');
3796+
var _hasText = _this10.$selectItems.filter("[data-group=\"".concat(group, "\"]")).closest('li').filter(':visible').length;
37883797

3789-
var _hasText = $items.filter(sprintf(_templateObject26(), s)(group)).length;
37903798
$parent.closest('li')[_hasText ? 'show' : 'hide']();
37913799
}
37923800
}); // Check if no matches found
@@ -3811,7 +3819,7 @@ function () {
38113819
return;
38123820
}
38133821

3814-
this.$el.before(this.$parent).show();
3822+
this.$el.before(this.$parent).removeClass('ms-offscreen');
38153823
this.$parent.remove();
38163824

38173825
if (this.fromHtml) {

dist/multiple-select-es.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/multiple-select-locale-all.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/multiple-select-vue.es.js

+3
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,9 @@ var script = {
18131813

18141814
this._initDefaultValue();
18151815
},
1816+
destroyed: function destroyed() {
1817+
this.destroy();
1818+
},
18161819
methods: _objectSpread2({
18171820
_initSelect: function _initSelect() {
18181821
var options = _objectSpread2({}, deepCopy(this.options), {

dist/multiple-select-vue.es.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/multiple-select-vue.js

+3
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,9 @@
18191819

18201820
this._initDefaultValue();
18211821
},
1822+
destroyed: function destroyed() {
1823+
this.destroy();
1824+
},
18221825
methods: _objectSpread2({
18231826
_initSelect: function _initSelect() {
18241827
var options = _objectSpread2({}, deepCopy(this.options), {

dist/multiple-select-vue.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)