Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#926: Maintain groups in search mode #1152

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions public/assets/scripts/choices.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! choices.js v10.2.0 | © 2022 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v10.2.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
Expand Down Expand Up @@ -884,12 +884,20 @@ var Choices = /** @class */function () {
var _a = this.config,
renderSelectedChoices = _a.renderSelectedChoices,
searchResultLimit = _a.searchResultLimit,
renderChoiceLimit = _a.renderChoiceLimit;
renderChoiceLimit = _a.renderChoiceLimit,
appendGroupInSearch = _a.appendGroupInSearch;
var filter = this._isSearching ? utils_1.sortByScore : this.config.sorter;
var appendChoice = function (choice) {
var groupName;
_this._store.groups.forEach(function (group) {
return group.id === choice.groupId ? groupName = group.value : false;
});
var shouldRender = renderSelectedChoices === 'auto' ? _this._isSelectOneElement || !choice.selected : true;
if (shouldRender) {
var dropdownItem = _this._getTemplate('choice', choice, _this.config.itemSelectText);
if (appendGroupInSearch && groupName && _this._isSearching) {
dropdownItem.innerHTML += " (".concat(groupName, ")");
}
fragment.appendChild(dropdownItem);
}
};
Expand Down Expand Up @@ -2920,7 +2928,8 @@ exports.DEFAULT_CONFIG = {
labelId: '',
callbackOnInit: null,
callbackOnCreateTemplates: null,
classNames: exports.DEFAULT_CLASSNAMES
classNames: exports.DEFAULT_CLASSNAMES,
appendGroupInSearch: false
};

/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/scripts/choices.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*! choices.js v10.2.0 | © 2022 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
/*! choices.js v10.2.0 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
2 changes: 1 addition & 1 deletion public/types/src/scripts/choices.d.ts.map

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

2 changes: 1 addition & 1 deletion public/types/src/scripts/defaults.d.ts.map

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

1 change: 1 addition & 0 deletions public/types/src/scripts/interfaces/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,5 +460,6 @@ export interface Options {
* @default null
*/
callbackOnCreateTemplates: ((template: Types.StrToEl) => void) | null;
appendGroupInSearch: false;
}
//# sourceMappingURL=options.d.ts.map
Loading