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

[Backport 4.2.x] Extend keyword picker directive to support displaying all the suggested values when there is a selected value. #8403

Merged
merged 1 commit into from
Oct 7, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@
scope.orderById = attrs.orderById || "false";
scope.max = gnThesaurusService.DEFAULT_NUMBER_OF_RESULTS;
scope.fauxMultilingual = scope.fauxMultilingual === "true"; //default false
scope.showHintsOnFocus = attrs.showHintsOnFocus === "true"; // displays all the values on focus, default shows only the selected value

// Configuration only required when using the directive in template fields.
//
Expand Down Expand Up @@ -910,7 +911,8 @@
.typeahead(
{
minLength: 0,
highlight: true
highlight: true,
showHintsOnFocus: scope.showHintsOnFocus
},
{
name: "keyword",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,7 @@
www.mixin(this);
this.eventBus = o.eventBus;
this.minLength = _.isNumber(o.minLength) ? o.minLength : 1;
this.showHintsOnFocus = o.showHintsOnFocus ? true : false;
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
Expand Down Expand Up @@ -2032,7 +2033,11 @@
this.eventBus.trigger("asyncreceive", query, dataset);
},
_onFocused: function onFocused() {
if (!this.showHintsOnFocus) {
this._minLengthMet() && this.menu.update(this.input.getQuery());
} else {
this._minLengthMet() && this.menu.update("");
}
},
_onBlurred: function onBlurred() {
if (this.input.hasQueryChangedSinceLastFocus()) {
Expand Down Expand Up @@ -2277,7 +2282,8 @@
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
showHintsOnFocus: o.showHintsOnFocus
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
Expand Down
Loading