Skip to content

Commit

Permalink
chosen v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrohnstock committed Mar 4, 2015
1 parent b5b5bc9 commit dc4acd3
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"homepage": "http://harvesthq.github.io/chosen/",
"version": "1.3.0",
"version": "1.4.0",
"keywords": [
"select",
"multiselect",
Expand Down
5 changes: 2 additions & 3 deletions component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"repo": "drmonty/chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"version": "1.3.0",
"version": "1.4.0",
"homepage": "http://harvesthq.github.io/chosen/",
"license": "MIT",
"keywords": [
Expand All @@ -26,6 +26,5 @@
"css/chosen.min.css",
"css/chosen-sprite.png",
"css/[email protected]"
],
"license": "MIT"
]
}
19 changes: 16 additions & 3 deletions css/chosen.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.3.0
Version 1.4.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2014 Harvest http://getharvest.com
Copyright (c) 2011-2015 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand Down Expand Up @@ -44,6 +44,19 @@ This file is generated by `grunt build`, do not edit it by hand.
.chosen-container a {
cursor: pointer;
}
.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
margin-right: 4px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-weight: normal;
color: #999999;
}
.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
content: ":";
padding-left: 2px;
vertical-align: top;
}

/* @end */
/* @group Single Chosen */
Expand Down Expand Up @@ -421,7 +434,7 @@ This file is generated by `grunt build`, do not edit it by hand.

/* @end */
/* @group Retina compatibility */
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
.chosen-rtl .chosen-search input[type="text"],
.chosen-container-single .chosen-single abbr,
.chosen-container-single .chosen-single div b,
Expand Down
4 changes: 2 additions & 2 deletions css/chosen.min.css

Large diffs are not rendered by default.

35 changes: 27 additions & 8 deletions js/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.3.0
Version 1.4.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2014 Harvest http://getharvest.com
Copyright (c) 2011-2015 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand Down Expand Up @@ -36,6 +36,7 @@ This file is generated by `grunt build`, do not edit it by hand.
array_index: group_position,
group: true,
label: this.escapeExpression(group.label),
title: group.title ? group.title : void 0,
children: 0,
disabled: group.disabled,
classes: group.className
Expand All @@ -61,9 +62,11 @@ This file is generated by `grunt build`, do not edit it by hand.
value: option.value,
text: option.text,
html: option.innerHTML,
title: option.title ? option.title : void 0,
selected: option.selected,
disabled: group_disabled === true ? group_disabled : option.disabled,
group_array_index: group_position,
group_label: group_position != null ? this.parsed[group_position].label : null,
classes: option.className,
style: option.style.cssText
});
Expand Down Expand Up @@ -152,7 +155,8 @@ This file is generated by `grunt build`, do not edit it by hand.
this.max_selected_options = this.options.max_selected_options || Infinity;
this.inherit_select_classes = this.options.inherit_select_classes || false;
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
};

AbstractChosen.prototype.set_default_text = function() {
Expand All @@ -166,6 +170,14 @@ This file is generated by `grunt build`, do not edit it by hand.
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
};

AbstractChosen.prototype.choice_label = function(item) {
if (this.include_group_label_in_selected && (item.group_label != null)) {
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
} else {
return item.html;
}
};

AbstractChosen.prototype.mouse_enter = function() {
return this.mouse_on_container = true;
};
Expand Down Expand Up @@ -214,7 +226,7 @@ This file is generated by `grunt build`, do not edit it by hand.
if (data.selected && this.is_multiple) {
this.choice_build(data);
} else if (data.selected && !this.is_multiple) {
this.single_set_selected_text(data.text);
this.single_set_selected_text(data.html);
}
}
}
Expand Down Expand Up @@ -250,6 +262,9 @@ This file is generated by `grunt build`, do not edit it by hand.
option_el.style.cssText = option.style;
option_el.setAttribute("data-option-array-index", option.array_index);
option_el.innerHTML = option.search_text;
if (option.title) {
option_el.title = option.title;
}
return this.outerHTML(option_el);
};

Expand All @@ -269,6 +284,9 @@ This file is generated by `grunt build`, do not edit it by hand.
group_el = document.createElement("li");
group_el.className = classes.join(" ");
group_el.innerHTML = group.search_text;
if (group.title) {
group_el.title = group.title;
}
return this.outerHTML(group_el);
};

Expand Down Expand Up @@ -341,7 +359,7 @@ This file is generated by `grunt build`, do not edit it by hand.
results_group.active_options += 1;
}
if (!(option.group && !this.group_search)) {
option.search_text = option.group ? option.label : option.text;
option.search_text = option.group ? option.label : option.html;
option.search_match = this.search_string_match(option.search_text, regex);
if (option.search_match && !option.group) {
results += 1;
Expand Down Expand Up @@ -946,7 +964,7 @@ This file is generated by `grunt build`, do not edit it by hand.
_this = this;
choice = $('<li />', {
"class": "search-choice"
}).html("<span>" + item.html + "</span>");
}).html("<span>" + (this.choice_label(item)) + "</span>");
if (item.disabled) {
choice.addClass('search-choice-disabled');
} else {
Expand Down Expand Up @@ -1021,7 +1039,7 @@ This file is generated by `grunt build`, do not edit it by hand.
if (this.is_multiple) {
this.choice_build(item);
} else {
this.single_set_selected_text(item.text);
this.single_set_selected_text(this.choice_label(item));
}
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
this.results_hide();
Expand All @@ -1033,6 +1051,7 @@ This file is generated by `grunt build`, do not edit it by hand.
});
}
this.current_selectedIndex = this.form_field.selectedIndex;
evt.preventDefault();
return this.search_field_scale();
}
};
Expand All @@ -1047,7 +1066,7 @@ This file is generated by `grunt build`, do not edit it by hand.
this.single_deselect_control_build();
this.selected_item.removeClass("chosen-default");
}
return this.selected_item.find("span").text(text);
return this.selected_item.find("span").html(text);
};

Chosen.prototype.result_deselect = function(pos) {
Expand Down
4 changes: 2 additions & 2 deletions js/chosen.jquery.min.js

Large diffs are not rendered by default.

33 changes: 26 additions & 7 deletions js/chosen.proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.3.0
Version 1.4.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2014 Harvest http://getharvest.com
Copyright (c) 2011-2015 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
Expand Down Expand Up @@ -36,6 +36,7 @@ This file is generated by `grunt build`, do not edit it by hand.
array_index: group_position,
group: true,
label: this.escapeExpression(group.label),
title: group.title ? group.title : void 0,
children: 0,
disabled: group.disabled,
classes: group.className
Expand All @@ -61,9 +62,11 @@ This file is generated by `grunt build`, do not edit it by hand.
value: option.value,
text: option.text,
html: option.innerHTML,
title: option.title ? option.title : void 0,
selected: option.selected,
disabled: group_disabled === true ? group_disabled : option.disabled,
group_array_index: group_position,
group_label: group_position != null ? this.parsed[group_position].label : null,
classes: option.className,
style: option.style.cssText
});
Expand Down Expand Up @@ -152,7 +155,8 @@ This file is generated by `grunt build`, do not edit it by hand.
this.max_selected_options = this.options.max_selected_options || Infinity;
this.inherit_select_classes = this.options.inherit_select_classes || false;
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
};

AbstractChosen.prototype.set_default_text = function() {
Expand All @@ -166,6 +170,14 @@ This file is generated by `grunt build`, do not edit it by hand.
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
};

AbstractChosen.prototype.choice_label = function(item) {
if (this.include_group_label_in_selected && (item.group_label != null)) {
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
} else {
return item.html;
}
};

AbstractChosen.prototype.mouse_enter = function() {
return this.mouse_on_container = true;
};
Expand Down Expand Up @@ -214,7 +226,7 @@ This file is generated by `grunt build`, do not edit it by hand.
if (data.selected && this.is_multiple) {
this.choice_build(data);
} else if (data.selected && !this.is_multiple) {
this.single_set_selected_text(data.text);
this.single_set_selected_text(data.html);
}
}
}
Expand Down Expand Up @@ -250,6 +262,9 @@ This file is generated by `grunt build`, do not edit it by hand.
option_el.style.cssText = option.style;
option_el.setAttribute("data-option-array-index", option.array_index);
option_el.innerHTML = option.search_text;
if (option.title) {
option_el.title = option.title;
}
return this.outerHTML(option_el);
};

Expand All @@ -269,6 +284,9 @@ This file is generated by `grunt build`, do not edit it by hand.
group_el = document.createElement("li");
group_el.className = classes.join(" ");
group_el.innerHTML = group.search_text;
if (group.title) {
group_el.title = group.title;
}
return this.outerHTML(group_el);
};

Expand Down Expand Up @@ -341,7 +359,7 @@ This file is generated by `grunt build`, do not edit it by hand.
results_group.active_options += 1;
}
if (!(option.group && !this.group_search)) {
option.search_text = option.group ? option.label : option.text;
option.search_text = option.group ? option.label : option.html;
option.search_match = this.search_string_match(option.search_text, regex);
if (option.search_match && !option.group) {
results += 1;
Expand Down Expand Up @@ -943,7 +961,7 @@ This file is generated by `grunt build`, do not edit it by hand.
_this = this;
choice = new Element('li', {
"class": "search-choice"
}).update("<span>" + item.html + "</span>");
}).update("<span>" + (this.choice_label(item)) + "</span>");
if (item.disabled) {
choice.addClassName('search-choice-disabled');
} else {
Expand Down Expand Up @@ -1028,7 +1046,7 @@ This file is generated by `grunt build`, do not edit it by hand.
if (this.is_multiple) {
this.choice_build(item);
} else {
this.single_set_selected_text(item.text);
this.single_set_selected_text(this.choice_label(item));
}
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
this.results_hide();
Expand All @@ -1038,6 +1056,7 @@ This file is generated by `grunt build`, do not edit it by hand.
this.form_field.simulate("change");
}
this.current_selectedIndex = this.form_field.selectedIndex;
evt.preventDefault();
return this.search_field_scale();
}
};
Expand Down
4 changes: 2 additions & 2 deletions js/chosen.proto.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drmonty-chosen",
"description": "Chosen is a library for making long, unwieldy select boxes more friendly.",
"homepage": "http://harvesthq.github.io/chosen/",
"version": "1.3.0",
"version": "1.4.0",
"keywords": [
"select",
"multiselect",
Expand Down

0 comments on commit dc4acd3

Please sign in to comment.