Skip to content

Commit

Permalink
Merge pull request #489 from wenzhixin/develop
Browse files Browse the repository at this point in the history
Release 1.4.2
  • Loading branch information
wenzhixin committed Oct 10, 2019
2 parents 4fbf913 + 6ca2656 commit 5bd52fe
Show file tree
Hide file tree
Showing 48 changed files with 544 additions and 271 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ build
docs_

# use scss instead
src/multiple-select.css
src/multiple-select.css.map
src/**/*.css
src/**/*.css.map

# Common IDE files
nbproject
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
## Changelog

### 1.4.2

- **New:** Added `string/number` array support for `data` option.
- **New:** Added `required` attribute support.
- **New:** Added bootstrap(v3, v4) themes support.
- **Update:** Improved `onAfterCreate` event.
- **Update:** Fixed `destroyed` bug of vue component.
- **Update:** Fixed display bug of only one member of group.
- **Update:** Fixed single group filter bug.

### 1.4.1

- **New:** Added `displayHtml` option.
Expand Down
2 changes: 1 addition & 1 deletion dist/locale/multiple-select-en-US.min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
*
* @version v1.4.1
* @version v1.4.2
* @homepage http://multiple-select.wenzhixin.net.cn
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/locale/multiple-select-es-ES.min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
*
* @version v1.4.1
* @version v1.4.2
* @homepage http://multiple-select.wenzhixin.net.cn
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/locale/multiple-select-zh-CN.min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
*
* @version v1.4.1
* @version v1.4.2
* @homepage http://multiple-select.wenzhixin.net.cn
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT
Expand Down
2 changes: 1 addition & 1 deletion dist/locale/multiple-select-zh-TW.min.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* multiple-select - Multiple select is a jQuery plugin to select multiple elements with checkboxes :).
*
* @version v1.4.1
* @version v1.4.2
* @homepage http://multiple-select.wenzhixin.net.cn
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT
Expand Down
76 changes: 42 additions & 34 deletions dist/multiple-select-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes
}
});

var VERSION = '1.4.1';
var VERSION = '1.4.2';
var DEFAULTS = {
name: '',
placeholder: '',
Expand Down Expand Up @@ -2706,7 +2706,7 @@ var removeDiacritics = function removeDiacritics(str) {
};

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

_templateObject26 = function _templateObject26() {
return data;
Expand Down Expand Up @@ -2746,7 +2746,7 @@ function _templateObject23() {
}

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

_templateObject22 = function _templateObject22() {
return data;
Expand All @@ -2756,7 +2756,7 @@ function _templateObject22() {
}

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

_templateObject21 = function _templateObject21() {
return data;
Expand All @@ -2766,7 +2766,7 @@ function _templateObject21() {
}

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

_templateObject20 = function _templateObject20() {
return data;
Expand All @@ -2786,7 +2786,7 @@ function _templateObject19() {
}

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

_templateObject18 = function _templateObject18() {
return data;
Expand All @@ -2796,7 +2796,7 @@ function _templateObject18() {
}

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

_templateObject17 = function _templateObject17() {
return data;
Expand All @@ -2806,7 +2806,7 @@ function _templateObject17() {
}

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

_templateObject16 = function _templateObject16() {
return data;
Expand All @@ -2816,7 +2816,7 @@ function _templateObject16() {
}

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

_templateObject15 = function _templateObject15() {
return data;
Expand All @@ -2826,7 +2826,7 @@ function _templateObject15() {
}

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

_templateObject14 = function _templateObject14() {
return data;
Expand All @@ -2836,7 +2836,7 @@ function _templateObject14() {
}

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

_templateObject13 = function _templateObject13() {
return data;
Expand All @@ -2846,7 +2846,7 @@ function _templateObject13() {
}

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

_templateObject12 = function _templateObject12() {
return data;
Expand All @@ -2856,7 +2856,7 @@ function _templateObject12() {
}

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

_templateObject11 = function _templateObject11() {
return data;
Expand Down Expand Up @@ -2984,6 +2984,7 @@ function () {
this.initFilter();
this.initDrop();
this.initView();
this.options.onAfterCreate();
}
}, {
key: "initLocale",
Expand Down Expand Up @@ -3014,7 +3015,7 @@ function () {
var el = this.$el[0];
var name = el.getAttribute('name') || this.options.name || ''; // hide select element

this.$el = this.$el.hide(); // label element
this.$el.hide(); // label element

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

Expand Down Expand Up @@ -3061,8 +3062,6 @@ function () {
}
});
}

this.options.onAfterCreate();
}
}, {
key: "initData",
Expand All @@ -3080,7 +3079,16 @@ function () {
});
}
});
this.data = this.options.data;
this.data = this.options.data.map(function (it) {
if (typeof it === 'string' || typeof it === 'number') {
return {
text: it,
value: it
};
}

return it;
});
return;
}

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

var html = [];
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(''));
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(''));
html.push(row.children.map(function (child) {
return _this6.initListItem(child, 1);
}).join(''));
return html.join('');
}

var customStyle = this.options.styler(row);
var style = customStyle ? sprintf(_templateObject12(), s)(customStyle) : '';
var style = customStyle ? sprintf(_templateObject13(), s)(customStyle) : '';
classes += row.classes || '';

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

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('');
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('');
}
}, {
key: "initView",
Expand All @@ -3277,6 +3285,7 @@ function () {
}

this.$parent.css('width', this.options.width || computedWidth);
this.$el.show().addClass('ms-offscreen');
}
}, {
key: "events",
Expand Down Expand Up @@ -3366,7 +3375,7 @@ function () {

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

var $children = $items.filter(sprintf(_templateObject18(), s)(group));
var $children = $items.filter(sprintf(_templateObject19(), s)(group));
var checked = $children.length !== $children.filter(':checked').length;
$children.prop('checked', checked);

Expand Down Expand Up @@ -3566,7 +3575,7 @@ function () {

$.each(this.$selectGroups, function (i, val) {
var group = $(val).parent()[0].getAttribute('data-group');
var $children = $items.filter(sprintf(_templateObject19(), s)(group));
var $children = $items.filter(sprintf(_templateObject20(), s)(group));
$(val).prop('checked', $children.length && $children.length === $children.filter(':checked').length);
});
}
Expand Down Expand Up @@ -3598,19 +3607,19 @@ function () {

var texts = [];
var values = [];
this.$drop.find(sprintf(_templateObject20(), s)(this.selectItemName)).each(function (i, el) {
this.$drop.find(sprintf(_templateObject21(), s)(this.selectItemName)).each(function (i, el) {
texts.push($(el).next()[type === 'html' ? 'html' : 'text']());
values.push($(el).val());
});

if (type === 'text' && this.$selectGroups.length) {
if (type === 'text' && this.$selectGroups.length && !this.options.single) {
texts = [];
this.$selectGroups.each(function (i, el) {
var html = [];
var text = $.trim($(el).parent().text());
var group = $(el).parent().data('group');

var $children = _this8.$drop.find(sprintf(_templateObject21(), s, s)(_this8.selectItemName, group));
var $children = _this8.$drop.find(sprintf(_templateObject22(), s, s)(_this8.selectItemName, group));

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

Expand All @@ -3621,7 +3630,7 @@ function () {
html.push('[');
html.push(text);

if ($children.length > $selected.length) {
if ($children.length >= $selected.length) {
var list = [];
$selected.each(function (j, elem) {
list.push($(elem).parent().text());
Expand All @@ -3644,9 +3653,9 @@ function () {
this.$selectItems.prop('checked', false);
this.$disableItems.prop('checked', false);
$.each(values, function (i, value) {
_this9.$selectItems.filter(sprintf(_templateObject22(), s)(value)).prop('checked', true);
_this9.$selectItems.filter(sprintf(_templateObject23(), s)(value)).prop('checked', true);

_this9.$disableItems.filter(sprintf(_templateObject23(), s)(value)).prop('checked', true);
_this9.$disableItems.filter(sprintf(_templateObject24(), s)(value)).prop('checked', true);
});
this.$selectAll.prop('checked', this.$selectItems.length === this.$selectItems.filter(':checked').length + this.$disableItems.filter(':checked').length);
$.each(this.$selectGroups, function (i, val) {
Expand Down Expand Up @@ -3686,8 +3695,8 @@ function () {
}, {
key: "_check",
value: function _check(value, checked) {
this.$selectItems.filter(sprintf(_templateObject24(), s)(value)).prop('checked', checked);
this.$disableItems.filter(sprintf(_templateObject25(), s)(value)).prop('checked', checked);
this.$selectItems.filter(sprintf(_templateObject25(), s)(value)).prop('checked', checked);
this.$disableItems.filter(sprintf(_templateObject26(), s)(value)).prop('checked', checked);
this.update();
this.updateOptGroupSelect(true);
this.updateSelectAll(true, true);
Expand Down Expand Up @@ -3784,9 +3793,8 @@ function () {

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

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

this.$el.before(this.$parent).show();
this.$el.before(this.$parent).removeClass('ms-offscreen');
this.$parent.remove();

if (this.fromHtml) {
Expand Down
4 changes: 2 additions & 2 deletions dist/multiple-select-es.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/multiple-select-locale-all.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/multiple-select-vue.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,9 @@ var script = {

this._initDefaultValue();
},
destroyed: function destroyed() {
this.destroy();
},
methods: _objectSpread2({
_initSelect: function _initSelect() {
var options = _objectSpread2({}, deepCopy(this.options), {
Expand Down
4 changes: 2 additions & 2 deletions dist/multiple-select-vue.es.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/multiple-select-vue.js
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,9 @@

this._initDefaultValue();
},
destroyed: function destroyed() {
this.destroy();
},
methods: _objectSpread2({
_initSelect: function _initSelect() {
var options = _objectSpread2({}, deepCopy(this.options), {
Expand Down
4 changes: 2 additions & 2 deletions dist/multiple-select-vue.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5bd52fe

Please sign in to comment.