diff --git a/src/main/java/sirius/web/controller/AutocompleteHelper.java b/src/main/java/sirius/web/controller/AutocompleteHelper.java index abfd338aa..3ca7b541a 100644 --- a/src/main/java/sirius/web/controller/AutocompleteHelper.java +++ b/src/main/java/sirius/web/controller/AutocompleteHelper.java @@ -12,6 +12,7 @@ import sirius.kernel.xml.StructuredOutput; import sirius.web.http.WebContext; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; /** @@ -98,25 +99,25 @@ public Completion markDisabled() { return this; } - private void writeTo(StructuredOutput out) { - out.beginObject("completion"); + private void writeTo(StructuredOutput output) { + output.beginObject("completion"); { - out.property("value", value); - out.property("fieldLabel", fieldLabel); - out.property("completionLabel", Strings.isFilled(completionLabel) ? completionLabel : fieldLabel); - out.property("completionDescription", completionDescription); + output.property("value", value); + output.property("fieldLabel", fieldLabel); + output.property("completionLabel", Strings.isFilled(completionLabel) ? completionLabel : fieldLabel); + output.property("completionDescription", completionDescription); // LEGACY SUPPORT.... - out.property("id", value); - out.property("text", fieldLabel == null ? "" : fieldLabel); - out.property("description", Strings.isFilled(completionLabel) ? completionLabel : fieldLabel); + output.property("id", value); + output.property("text", fieldLabel == null ? "" : fieldLabel); + output.property("description", Strings.isFilled(completionLabel) ? completionLabel : fieldLabel); // END OF LEGACY SUPPORT if (disabled) { - out.property("disabled", true); + output.property("disabled", true); } } - out.endObject(); + output.endObject(); } } @@ -149,19 +150,83 @@ public static Completion suggest(String code) { /** * Handles the given request and generates the appropriate JSON as expected by the autocomplete in JavaScript. * - * @param ctx the request to handle - * @param search the handler to generate suggestions + * @param webContext the request to handle + * @param search the handler to generate suggestions */ - public static void handle(WebContext ctx, ItemSearch search) { - StructuredOutput out = ctx.respondWith().json(); - out.beginResult(); - out.beginArray("completions"); - search.search(ctx.get("query").asString(), c -> { + public static void handle(WebContext webContext, ItemSearch search) { + StructuredOutput output = webContext.respondWith().json(); + output.beginResult(); + output.beginArray("completions"); + search.search(webContext.get("query").asString(), c -> { if (Strings.isFilled(c.value)) { - c.writeTo(out); + c.writeTo(output); } }); - out.endArray(); - out.endResult(); + output.endArray(); + output.endResult(); + } + + /** + * Handles the given request and generates the appropriate JSON as expected by the autocomplete in JavaScript. + * Also adds a "hasMore" entry with the given text if the given limit is reached. + * + * @param webContext the request to handle + * @param search the handler to generate suggestions + * @param limit the maximum number of suggestions to generate + * @param hint the hint to show for the "hasMore" entry + */ + public static void handleWithMore(WebContext webContext, ItemSearch search, int limit, String hint) { + AtomicInteger counter = new AtomicInteger(); + StructuredOutput output = webContext.respondWith().json(); + output.beginResult(); + output.beginArray("completions"); + search.search(webContext.get("query").asString(), completion -> { + if (counter.get() < limit) { + if (Strings.isFilled(completion.value)) { + completion.writeTo(output); + counter.incrementAndGet(); + } + } else if (counter.get() == limit) { + new Completion("hasMore").markDisabled().withFieldLabel(hint).writeTo(output); + counter.incrementAndGet(); + } + }); + output.endArray(); + output.endResult(); + } + + /** + * Handles the given request and generates the appropriate JSON as expected by the autocomplete in JavaScript. + * Also adds a "hasMore" entry with "..." if the given limit is reached. + * + * @param webContext the request to handle + * @param search the handler to generate suggestions + * @param limit the maximum number of suggestions to generate + */ + public static void handleWithMore(WebContext webContext, ItemSearch search, int limit) { + handleWithMore(webContext, search, limit, "..."); + } + + /** + * Handles the given request and generates the appropriate JSON as expected by the autocomplete in JavaScript. + * Also adds a "hasMore" entry with the given text if the DEFAULT_LIMIT limit is reached. + * + * @param webContext the request to handle + * @param search the handler to generate suggestions + * @param hint the hint to show for the "hasMore" entry + */ + public static void handleWithMore(WebContext webContext, ItemSearch search, String hint) { + handleWithMore(webContext, search, DEFAULT_LIMIT, hint); + } + + /** + * Handles the given request and generates the appropriate JSON as expected by the autocomplete in JavaScript. + * Also adds a "hasMore" entry with "..." if the DEFAULT_LIMIT is reached. + * + * @param webContext the request to handle + * @param search the handler to generate suggestions + */ + public static void handleWithMore(WebContext webContext, ItemSearch search) { + handleWithMore(webContext, search, DEFAULT_LIMIT, "..."); } } diff --git a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.css b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.css index 8c369abad..294ab0279 100644 --- a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.css +++ b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.css @@ -128,6 +128,11 @@ background-color: #fdfdfd; } +.token-autocomplete-container .token-autocomplete-suggestions li.token-autocomplete-suggestion-disabled, .token-autocomplete-container .token-autocomplete-suggestions li.token-autocomplete-suggestion-disabled:hover { + background-color: #cccccc; + cursor: unset; +} + .token-autocomplete-container .token-autocomplete-suggestions li.token-autocomplete-suggestion-active { color: #747474; background-color: #fdfdfd; diff --git a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js index b4522bc9b..b8936a4db 100644 --- a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js +++ b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js @@ -158,7 +158,8 @@ var TokenAutocomplete = /** @class */ (function () { fieldLabel: option.text, type: null, completionDescription: option.dataset.description || null, - completionLabel: null + completionLabel: null, + disabled: option.disabled || false }); } me.container.removeChild(option); @@ -313,185 +314,185 @@ var TokenAutocomplete = /** @class */ (function () { }; var _a, _b; TokenAutocomplete.MultiSelect = (_a = /** @class */ (function () { - function class_1(parent) { - this.parent = parent; - this.container = parent.container; - this.options = parent.options; - this.renderer = parent.options.tokenRenderer; - } - class_1.prototype.clearCurrentInput = function () { - this.parent.textInput.textContent = ''; - }; - class_1.prototype.initEventListeners = function () { - var me = this; - var parent = this.parent; - if (parent.options.readonly) { - return; + function class_1(parent) { + this.parent = parent; + this.container = parent.container; + this.options = parent.options; + this.renderer = parent.options.tokenRenderer; } - parent.textInput.addEventListener('compositionend', function (event) { - // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers - var inputString = event.data; - if (inputString.charAt(inputString.length - 1) === "\n") { - event.preventDefault(); - me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted')); + class_1.prototype.clearCurrentInput = function () { + this.parent.textInput.textContent = ''; + }; + class_1.prototype.initEventListeners = function () { + var me = this; + var parent = this.parent; + if (parent.options.readonly) { + return; } - }); - parent.textInput.addEventListener('keydown', function (event) { - if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) { - event.preventDefault(); - var highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); - if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) { - highlightedSuggestion = parent.autocomplete.suggestions.firstChild; + parent.textInput.addEventListener('compositionend', function (event) { + // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers + var inputString = event.data; + if (inputString.charAt(inputString.length - 1) === "\n") { + event.preventDefault(); + me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted')); + } + }); + parent.textInput.addEventListener('keydown', function (event) { + if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) { + event.preventDefault(); + var highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); + if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) { + highlightedSuggestion = parent.autocomplete.suggestions.firstChild; + } + me.handleInput(highlightedSuggestion); + } + else if (parent.getCurrentInput() === '' && event.key == parent.KEY_BACKSPACE) { + event.preventDefault(); + me.removeLastToken(); + } + if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) { + event.preventDefault(); + } + }); + }; + class_1.prototype.handleInput = function (highlightedSuggestion) { + if (highlightedSuggestion !== null) { + this.clearCurrentInput(); + if (highlightedSuggestion.classList.contains('token-autocomplete-suggestion-active')) { + this.removeTokenWithText(highlightedSuggestion.dataset.tokenText); + } + else { + if (highlightedSuggestion.dataset.becomesToken !== 'false') { + this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false); + } + this.parent.autocomplete.dispatchSuggestionSelectedEvent(highlightedSuggestion); } - me.handleInput(highlightedSuggestion); } - else if (parent.getCurrentInput() === '' && event.key == parent.KEY_BACKSPACE) { - event.preventDefault(); - me.removeLastToken(); + else { + this.handleInputAsValue(this.parent.getCurrentInput()); } - if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) { - event.preventDefault(); + this.parent.autocomplete.clearSuggestions(); + this.parent.autocomplete.hideSuggestions(); + }; + /** + * Adds the current user input as a net token and resets the input area so new text can be entered. + * + * @param {string} input - the actual input the user entered + */ + class_1.prototype.handleInputAsValue = function (input) { + if (input != '' && this.parent.options.allowCustomEntries) { + this.clearCurrentInput(); + this.addToken(input, input, null); + return; } - }); - }; - class_1.prototype.handleInput = function (highlightedSuggestion) { - if (highlightedSuggestion !== null) { - this.clearCurrentInput(); - if (highlightedSuggestion.classList.contains('token-autocomplete-suggestion-active')) { - this.removeTokenWithText(highlightedSuggestion.dataset.tokenText); + if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') { + this.parent.autocomplete.suggestions.firstChild.click(); } else { - if (highlightedSuggestion.dataset.becomesToken !== 'false') { - this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false); - } - this.parent.autocomplete.dispatchSuggestionSelectedEvent(highlightedSuggestion); + this.clearCurrentInput(); } - } - else { - this.handleInputAsValue(this.parent.getCurrentInput()); - } - this.parent.autocomplete.clearSuggestions(); - this.parent.autocomplete.hideSuggestions(); - }; - /** - * Adds the current user input as a net token and resets the input area so new text can be entered. - * - * @param {string} input - the actual input the user entered - */ - class_1.prototype.handleInputAsValue = function (input) { - if (input != '' && this.parent.options.allowCustomEntries) { - this.clearCurrentInput(); - this.addToken(input, input, null); - return; - } - if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') { - this.parent.autocomplete.suggestions.firstChild.click(); - } - else { - this.clearCurrentInput(); - } - }; - /** - * Adds a token with the specified name to the list of currently present tokens displayed to the user and the hidden select. - * - * @param {string} tokenValue - the actual value of the token to create - * @param {string} tokenText - the name of the token to create - * @param {string} tokenType - the type of the token to create - * @param {boolean} silent - whether an appropriate event should be triggered - */ - class_1.prototype.addToken = function (tokenValue, tokenText, tokenType, silent) { - var _c; - if (silent === void 0) { silent = false; } - if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') { - return; - } - tokenValue = tokenValue.trim(); - tokenText = tokenText.trim(); - this.parent.addHiddenOption(tokenValue, tokenText, tokenType); - var addedToken = { - value: tokenValue, - text: tokenText, - type: tokenType }; - var element = this.renderer(addedToken); - var me = this; - (_c = element.querySelector('.token-autocomplete-token-delete')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', function () { - me.removeToken(element); - }); - this.container.insertBefore(element, this.parent.textInput); - if (!silent) { - this.container.dispatchEvent(new CustomEvent('tokens-changed', { - detail: { - tokens: this.parent.val(), - added: addedToken - } - })); - } - this.parent.log('added token', addedToken); - }; - /** - * Completely clears the currently present tokens from the field. - */ - class_1.prototype.clear = function (silent) { - if (silent === void 0) { silent = false; } - var tokens = this.container.querySelectorAll('.token-autocomplete-token'); - var me = this; - tokens.forEach(function (token) { - me.removeToken(token, silent); - }); - }; - /** - * Removes the last token in the list of currently present token. This is the last added token next to the input field. - */ - class_1.prototype.removeLastToken = function () { - var tokens = this.container.querySelectorAll('.token-autocomplete-token'); - var token = tokens[tokens.length - 1]; - if (token) { - this.removeToken(token); - } - }; - /** - * Removes the specified token from the list of currently present tokens. - * - * @param {Element} token - the token to remove - * @param {boolean} silent - whether an appropriate event should be triggered - */ - class_1.prototype.removeToken = function (token, silent) { - var _c; - if (silent === void 0) { silent = false; } - this.container.removeChild(token); - var tokenText = token.dataset.text; - var hiddenOption = this.parent.hiddenSelect.querySelector('option[data-text="' + TokenAutocomplete.escapeQuotes(tokenText) + '"]'); - (_c = hiddenOption === null || hiddenOption === void 0 ? void 0 : hiddenOption.parentElement) === null || _c === void 0 ? void 0 : _c.removeChild(hiddenOption); - var addedToken = { - value: token.dataset.value, - text: tokenText, - type: token.dataset.type || null + /** + * Adds a token with the specified name to the list of currently present tokens displayed to the user and the hidden select. + * + * @param {string} tokenValue - the actual value of the token to create + * @param {string} tokenText - the name of the token to create + * @param {string} tokenType - the type of the token to create + * @param {boolean} silent - whether an appropriate event should be triggered + */ + class_1.prototype.addToken = function (tokenValue, tokenText, tokenType, silent) { + var _c; + if (silent === void 0) { silent = false; } + if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') { + return; + } + tokenValue = tokenValue.trim(); + tokenText = tokenText.trim(); + this.parent.addHiddenOption(tokenValue, tokenText, tokenType); + var addedToken = { + value: tokenValue, + text: tokenText, + type: tokenType + }; + var element = this.renderer(addedToken); + var me = this; + (_c = element.querySelector('.token-autocomplete-token-delete')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', function () { + me.removeToken(element); + }); + this.container.insertBefore(element, this.parent.textInput); + if (!silent) { + this.container.dispatchEvent(new CustomEvent('tokens-changed', { + detail: { + tokens: this.parent.val(), + added: addedToken + } + })); + } + this.parent.log('added token', addedToken); }; - if (!silent) { - this.container.dispatchEvent(new CustomEvent('tokens-changed', { - detail: { - tokens: this.parent.val(), - removed: addedToken - } - })); - } - if (this.parent.val().length === 0) { - this.parent.addHiddenEmptyOption(); - } - this.parent.log('removed token', token.textContent); - }; - class_1.prototype.removeTokenWithText = function (tokenText) { - if (tokenText === null) { - return; - } - var token = this.container.querySelector('.token-autocomplete-token[data-text="' + TokenAutocomplete.escapeQuotes(tokenText) + '"]'); - if (token !== null) { - this.removeToken(token); - } - }; - return class_1; - }()), + /** + * Completely clears the currently present tokens from the field. + */ + class_1.prototype.clear = function (silent) { + if (silent === void 0) { silent = false; } + var tokens = this.container.querySelectorAll('.token-autocomplete-token'); + var me = this; + tokens.forEach(function (token) { + me.removeToken(token, silent); + }); + }; + /** + * Removes the last token in the list of currently present token. This is the last added token next to the input field. + */ + class_1.prototype.removeLastToken = function () { + var tokens = this.container.querySelectorAll('.token-autocomplete-token'); + var token = tokens[tokens.length - 1]; + if (token) { + this.removeToken(token); + } + }; + /** + * Removes the specified token from the list of currently present tokens. + * + * @param {Element} token - the token to remove + * @param {boolean} silent - whether an appropriate event should be triggered + */ + class_1.prototype.removeToken = function (token, silent) { + var _c; + if (silent === void 0) { silent = false; } + this.container.removeChild(token); + var tokenText = token.dataset.text; + var hiddenOption = this.parent.hiddenSelect.querySelector('option[data-text="' + TokenAutocomplete.escapeQuotes(tokenText) + '"]'); + (_c = hiddenOption === null || hiddenOption === void 0 ? void 0 : hiddenOption.parentElement) === null || _c === void 0 ? void 0 : _c.removeChild(hiddenOption); + var addedToken = { + value: token.dataset.value, + text: tokenText, + type: token.dataset.type || null + }; + if (!silent) { + this.container.dispatchEvent(new CustomEvent('tokens-changed', { + detail: { + tokens: this.parent.val(), + removed: addedToken + } + })); + } + if (this.parent.val().length === 0) { + this.parent.addHiddenEmptyOption(); + } + this.parent.log('removed token', token.textContent); + }; + class_1.prototype.removeTokenWithText = function (tokenText) { + if (tokenText === null) { + return; + } + var token = this.container.querySelector('.token-autocomplete-token[data-text="' + TokenAutocomplete.escapeQuotes(tokenText) + '"]'); + if (token !== null) { + this.removeToken(token); + } + }; + return class_1; + }()), __setFunctionName(_a, "MultiSelect"), _a.defaultRenderer = function (token) { var chip = document.createElement('span'); @@ -747,277 +748,142 @@ var TokenAutocomplete = /** @class */ (function () { return class_3; }(TokenAutocomplete.MultiSelect)); TokenAutocomplete.Autocomplete = (_b = /** @class */ (function () { - function class_4(parent) { - this.parent = parent; - this.container = parent.container; - this.options = parent.options; - this.renderer = parent.options.suggestionRenderer; - this.suggestions = document.createElement('ul'); - this.suggestions.id = this.container.id + '-suggestions'; - this.suggestions.classList.add('token-autocomplete-suggestions'); - this.container.appendChild(this.suggestions); - } - class_4.prototype.initEventListeners = function () { - var me = this; - if (me.parent.options.readonly) { - return; + function class_4(parent) { + this.parent = parent; + this.container = parent.container; + this.options = parent.options; + this.renderer = parent.options.suggestionRenderer; + this.suggestions = document.createElement('ul'); + this.suggestions.id = this.container.id + '-suggestions'; + this.suggestions.classList.add('token-autocomplete-suggestions'); + this.container.appendChild(this.suggestions); } - me.parent.textInput.addEventListener('keyup', function (event) { - if (event.key == me.parent.KEY_ESC) { - me.hideSuggestions(); - me.parent.textInput.blur(); + class_4.prototype.initEventListeners = function () { + var me = this; + if (me.parent.options.readonly) { return; } - if (event.key == me.parent.KEY_UP && me.suggestions.childNodes.length > 0) { - event.preventDefault(); - var highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); - if (highlightedSuggestion == null) { - // highlight last entry and scroll to bottom - me.highlightSuggestionAtPosition(me.suggestions.childNodes.length - 1); - me.suggestions.scrollTop = me.suggestions.scrollHeight; + me.parent.textInput.addEventListener('keyup', function (event) { + if (event.key == me.parent.KEY_ESC) { + me.hideSuggestions(); + me.parent.textInput.blur(); return; } - var aboveSuggestion = highlightedSuggestion.previousSibling; - if (aboveSuggestion != null) { - // if the suggestions is above the scroll position, scroll to the suggestion - var suggestionTop = aboveSuggestion.offsetTop; - if (me.suggestions.scrollTop > suggestionTop) { - me.suggestions.scrollTop = suggestionTop; + if (event.key == me.parent.KEY_UP && me.suggestions.childNodes.length > 0) { + event.preventDefault(); + var highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); + if (highlightedSuggestion == null) { + // highlight last entry and scroll to bottom + me.highlightSuggestionAtPosition(me.suggestions.childNodes.length - 1); + me.suggestions.scrollTop = me.suggestions.scrollHeight; + return; + } + var aboveSuggestion = highlightedSuggestion.previousSibling; + if (aboveSuggestion != null) { + // if the suggestions is above the scroll position, scroll to the suggestion + var suggestionTop = aboveSuggestion.offsetTop; + if (me.suggestions.scrollTop > suggestionTop) { + me.suggestions.scrollTop = suggestionTop; + } + me.highlightSuggestion(aboveSuggestion); + } + else { + highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); } - me.highlightSuggestion(aboveSuggestion); - } - else { - highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); - } - return; - } - if (event.key == me.parent.KEY_DOWN && me.suggestions.childNodes.length > 0) { - event.preventDefault(); - var highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); - if (highlightedSuggestion == null) { - // highlight first entry and scroll to top - me.highlightSuggestionAtPosition(0); - me.suggestions.scrollTop = 0; return; } - var belowSuggestion = highlightedSuggestion === null || highlightedSuggestion === void 0 ? void 0 : highlightedSuggestion.nextSibling; - if (belowSuggestion != null) { - // if the suggestions is not completely visible, scroll until the suggestion is at the bottom - var suggestionBottom = belowSuggestion.offsetTop + belowSuggestion.offsetHeight; - if (me.suggestions.scrollTop + me.suggestions.clientHeight < suggestionBottom) { - me.suggestions.scrollTop = suggestionBottom - me.suggestions.clientHeight; + if (event.key == me.parent.KEY_DOWN && me.suggestions.childNodes.length > 0) { + event.preventDefault(); + var highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'); + if (highlightedSuggestion == null) { + // highlight first entry and scroll to top + me.highlightSuggestionAtPosition(0); + me.suggestions.scrollTop = 0; + return; + } + var belowSuggestion = highlightedSuggestion === null || highlightedSuggestion === void 0 ? void 0 : highlightedSuggestion.nextSibling; + if (belowSuggestion != null) { + // if the suggestions is not completely visible, scroll until the suggestion is at the bottom + var suggestionBottom = belowSuggestion.offsetTop + belowSuggestion.offsetHeight; + if (me.suggestions.scrollTop + me.suggestions.clientHeight < suggestionBottom) { + me.suggestions.scrollTop = suggestionBottom - me.suggestions.clientHeight; + } + me.highlightSuggestion(belowSuggestion); + } + else { + highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); } - me.highlightSuggestion(belowSuggestion); - } - else { - highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); - } - return; - } - if (event.key == me.parent.KEY_LEFT || event.key == me.parent.KEY_RIGHT || event.key == me.parent.KEY_ENTER || event.key == me.parent.KEY_TAB) { - // We don't want to re-trigger the autocompletion when the user navigates the cursor inside the input. - return; - } - me.loadSuggestions(); - }); - me.parent.textInput.addEventListener('focusout', function () { - // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling. - // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input. - // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected. - // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example) - setTimeout(function () { - if (me.areSuggestionsActive()) { return; } - me.hideSuggestions(); - }, 0); - }); - me.parent.textInput.addEventListener('focusin', function () { - if (me.options.showSuggestionsOnFocus) { - me.loadSuggestions(); - me.showSuggestions(); - } - }); - }; - class_4.prototype.loadSuggestions = function () { - var me = this; - var value = me.parent.getCurrentInput(); - if (me.parent.options.selectMode == SelectModes.SINGLE) { - if (!me.parent.textInput.isContentEditable) { - me.parent.select.clear(true); - value = ""; - } - } - else if (value.length < me.parent.options.minCharactersForSuggestion) { - me.clearSuggestions(); - me.hideSuggestions(); - return; - } - if (me.parent.options.suggestionsUri.length > 0) { - me.requestSuggestions(value); - return; - } - if (Array.isArray(me.parent.options.initialSuggestions)) { - me.clearSuggestions(); - me.parent.options.initialSuggestions.forEach(function (suggestion) { - if (typeof suggestion !== 'object') { - // The suggestion is of wrong type and therefore ignored. + if (event.key == me.parent.KEY_LEFT || event.key == me.parent.KEY_RIGHT || event.key == me.parent.KEY_ENTER || event.key == me.parent.KEY_TAB) { + // We don't want to re-trigger the autocompletion when the user navigates the cursor inside the input. return; } - var text = suggestion.fieldLabel; - if (value.length == 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) { - me.addSuggestion(suggestion, false); - } - else if (value.localeCompare(text.slice(0, value.length), undefined, { sensitivity: 'base' }) === 0) { - // The suggestion starts with the query text the user entered and will be displayed. - me.addSuggestion(suggestion); - } + me.loadSuggestions(); }); - if (me.suggestions.childNodes.length == 0) { - if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) { - me.addSuggestion({ - id: null, - value: value, - fieldLabel: value, - type: '_no_match_', - completionDescription: me.parent.options.noMatchesCustomEntriesDescription, - completionLabel: null - }); + me.parent.textInput.addEventListener('focusout', function () { + // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling. + // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input. + // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected. + // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example) + setTimeout(function () { + if (me.areSuggestionsActive()) { + return; + } + me.hideSuggestions(); + }, 0); + }); + me.parent.textInput.addEventListener('focusin', function () { + if (me.options.showSuggestionsOnFocus) { + me.loadSuggestions(); + me.showSuggestions(); } - else if (me.parent.options.noMatchesText) { - me.addSuggestion({ - id: null, - value: '_no_match_', - fieldLabel: me.parent.options.noMatchesText, - type: '_no_match_', - completionDescription: null, - completionLabel: null - }); + }); + }; + class_4.prototype.loadSuggestions = function () { + var me = this; + var value = me.parent.getCurrentInput(); + if (me.parent.options.selectMode == SelectModes.SINGLE) { + if (!me.parent.textInput.isContentEditable) { + me.parent.select.clear(true); + value = ""; } } - } - }; - /** - * Hides the suggestions dropdown from the user. - */ - class_4.prototype.hideSuggestions = function () { - // as the suggestions will be re-shown if a pending request is executed, we abort them if we want to hide - this.abortPendingRequest(); - this.suggestions.style.display = ''; - var _highlightedSuggestions = this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted'); - _highlightedSuggestions.forEach(function (_suggestion) { - _suggestion.classList.remove('token-autocomplete-suggestion-highlighted'); - }); - }; - /** - * Shows the suggestions dropdown to the user. - */ - class_4.prototype.showSuggestions = function () { - this.suggestions.style.display = 'block'; - }; - class_4.prototype.areSuggestionsDisplayed = function () { - return this.suggestions.style.display === 'block'; - }; - class_4.prototype.highlightSuggestionAtPosition = function (index) { - var _suggestions = this.suggestions.querySelectorAll('li'); - _suggestions.forEach(function (_suggestion) { - _suggestion.classList.remove('token-autocomplete-suggestion-highlighted'); - }); - _suggestions[index].classList.add('token-autocomplete-suggestion-highlighted'); - }; - class_4.prototype.highlightSuggestion = function (_suggestion) { - this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted').forEach(function (_highlightedSuggestion) { - _highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); - }); - _suggestion.classList.add('token-autocomplete-suggestion-highlighted'); - }; - /** - * Checks for the presence of a suggestion that is currently clicked via mouse (active). - */ - class_4.prototype.areSuggestionsActive = function () { - return !!this.suggestions.querySelector('li:active'); - }; - /** - * Removes all previous suggestions from the dropdown. - */ - class_4.prototype.clearSuggestions = function () { - this.abortPendingRequest(); - this.suggestions.innerHTML = ''; - }; - /** - * Aborts currently in progress or scheduled suggestions requests. - */ - class_4.prototype.abortPendingRequest = function () { - var _c; - (_c = this.request) === null || _c === void 0 ? void 0 : _c.abort(); - clearTimeout(this.timeout); - }; - /** - * Loads suggestions matching the given query from the rest service behind the URI given as an option while initializing the field. - * - * @param query the query to search suggestions for - */ - class_4.prototype.requestSuggestions = function (query) { - var me = this; - clearTimeout(me.timeout); - if (!me.timeout) { - me.debouncedRequestSuggestions.call(me, query); - me.timeout = window.setTimeout(function () { - delete me.timeout; - }, me.parent.options.requestDelay); - } - else { - me.timeout = window.setTimeout(function () { - delete me.timeout; - me.debouncedRequestSuggestions.call(me, query); - }, me.parent.options.requestDelay); - } - }; - class_4.prototype.dispatchSuggestionSelectedEvent = function (_suggestion) { - _suggestion.dispatchEvent(new CustomEvent('suggestion-selected', { - detail: { - value: _suggestion.dataset.value, - text: _suggestion.dataset.text, - type: _suggestion.dataset.type || null + else if (value.length < me.parent.options.minCharactersForSuggestion) { + me.clearSuggestions(); + me.hideSuggestions(); + return; } - })); - }; - class_4.prototype.debouncedRequestSuggestions = function (query) { - var me = this; - if (me.request != null && me.request.readyState) { - me.request.abort(); - } - me.request = new XMLHttpRequest(); - me.request.onload = function () { - me.request = null; - me.clearSuggestions(); - var answer = this.response; - // IE 11 doesn't properly respect content type header, need to parse json string by hand. - if (typeof answer === 'string') { - answer = JSON.parse(answer); + if (me.parent.options.suggestionsUri.length > 0) { + me.requestSuggestions(value); + return; } - if (Array.isArray(answer.completions)) { - if (me.parent.val().length == 0 && answer.completions.length > 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) { - answer.completions.forEach(function (suggestion) { + if (Array.isArray(me.parent.options.initialSuggestions)) { + me.clearSuggestions(); + me.parent.options.initialSuggestions.forEach(function (suggestion) { + if (typeof suggestion !== 'object') { + // The suggestion is of wrong type and therefore ignored. + return; + } + var text = suggestion.fieldLabel; + if (value.length == 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) { me.addSuggestion(suggestion, false); - }); - var firstSuggestion = answer.completions[0]; - var value = firstSuggestion.id || firstSuggestion.value; - me.parent.select.addToken(value, firstSuggestion.fieldLabel, firstSuggestion.type, true); - return; - } - answer.completions.forEach(function (suggestion) { - me.addSuggestion(suggestion); + } + else if (value.localeCompare(text.slice(0, value.length), undefined, { sensitivity: 'base' }) === 0) { + // The suggestion starts with the query text the user entered and will be displayed. + me.addSuggestion(suggestion); + } }); if (me.suggestions.childNodes.length == 0) { if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) { me.addSuggestion({ id: null, - value: query, - fieldLabel: query, + value: value, + fieldLabel: value, type: '_no_match_', completionDescription: me.parent.options.noMatchesCustomEntriesDescription, - completionLabel: null + completionLabel: null, + disabled: true }); } else if (me.parent.options.noMatchesText) { @@ -1027,78 +893,220 @@ var TokenAutocomplete = /** @class */ (function () { fieldLabel: me.parent.options.noMatchesText, type: '_no_match_', completionDescription: null, - completionLabel: null + completionLabel: null, + disabled: true }); } } } }; - var suggestionsUri = me.options.suggestionsUriBuilder(query); - me.request.open('GET', suggestionsUri, true); - me.request.responseType = 'json'; - me.request.setRequestHeader('Content-type', 'application/json'); - me.request.send(); - }; - /** - * Adds a suggestion with the given text matching the users input to the dropdown. - * - * @param {string} suggestion - the metadata of the suggestion that should be added - * @param showSuggestions - if the suggestions box should be shown, default true - */ - class_4.prototype.addSuggestion = function (suggestion, showSuggestions) { - if (showSuggestions === void 0) { showSuggestions = true; } - var element = this.renderer(suggestion); - var value = suggestion.id || suggestion.value; - var text = suggestion.completionLabel || suggestion.fieldLabel; - element.dataset.value = value; - element.dataset.text = text; - element.dataset.tokenText = suggestion.fieldLabel; - if (suggestion.type != null) { - element.dataset.type = suggestion.type; - } - var me = this; - element.addEventListener('click', function (_event) { - if (value == '_no_match_') { - return; + /** + * Hides the suggestions dropdown from the user. + */ + class_4.prototype.hideSuggestions = function () { + // as the suggestions will be re-shown if a pending request is executed, we abort them if we want to hide + this.abortPendingRequest(); + this.suggestions.style.display = ''; + var _highlightedSuggestions = this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted'); + _highlightedSuggestions.forEach(function (_suggestion) { + _suggestion.classList.remove('token-autocomplete-suggestion-highlighted'); + }); + }; + /** + * Shows the suggestions dropdown to the user. + */ + class_4.prototype.showSuggestions = function () { + this.suggestions.style.display = 'block'; + }; + class_4.prototype.areSuggestionsDisplayed = function () { + return this.suggestions.style.display === 'block'; + }; + class_4.prototype.highlightSuggestionAtPosition = function (index) { + var _suggestions = this.suggestions.querySelectorAll('li'); + _suggestions.forEach(function (_suggestion) { + _suggestion.classList.remove('token-autocomplete-suggestion-highlighted'); + }); + _suggestions[index].classList.add('token-autocomplete-suggestion-highlighted'); + }; + class_4.prototype.highlightSuggestion = function (_suggestion) { + this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted').forEach(function (_highlightedSuggestion) { + _highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted'); + }); + _suggestion.classList.add('token-autocomplete-suggestion-highlighted'); + }; + /** + * Checks for the presence of a suggestion that is currently clicked via mouse (active). + */ + class_4.prototype.areSuggestionsActive = function () { + return !!this.suggestions.querySelector('li:active'); + }; + /** + * Removes all previous suggestions from the dropdown. + */ + class_4.prototype.clearSuggestions = function () { + this.abortPendingRequest(); + this.suggestions.innerHTML = ''; + }; + /** + * Aborts currently in progress or scheduled suggestions requests. + */ + class_4.prototype.abortPendingRequest = function () { + var _c; + (_c = this.request) === null || _c === void 0 ? void 0 : _c.abort(); + clearTimeout(this.timeout); + }; + /** + * Loads suggestions matching the given query from the rest service behind the URI given as an option while initializing the field. + * + * @param query the query to search suggestions for + */ + class_4.prototype.requestSuggestions = function (query) { + var me = this; + clearTimeout(me.timeout); + if (!me.timeout) { + me.debouncedRequestSuggestions.call(me, query); + me.timeout = window.setTimeout(function () { + delete me.timeout; + }, me.parent.options.requestDelay); } - if (me.parent.options.selectMode == SelectModes.SINGLE) { - if (element.classList.contains('token-autocomplete-suggestion-active')) { - me.parent.select.clear(false); + else { + me.timeout = window.setTimeout(function () { + delete me.timeout; + me.debouncedRequestSuggestions.call(me, query); + }, me.parent.options.requestDelay); + } + }; + class_4.prototype.dispatchSuggestionSelectedEvent = function (_suggestion) { + _suggestion.dispatchEvent(new CustomEvent('suggestion-selected', { + detail: { + value: _suggestion.dataset.value, + text: _suggestion.dataset.text, + type: _suggestion.dataset.type || null } - else { - if (element.dataset.becomesToken !== 'false') { - me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false); + })); + }; + class_4.prototype.debouncedRequestSuggestions = function (query) { + var me = this; + if (me.request != null && me.request.readyState) { + me.request.abort(); + } + me.request = new XMLHttpRequest(); + me.request.onload = function () { + me.request = null; + me.clearSuggestions(); + var answer = this.response; + // IE 11 doesn't properly respect content type header, need to parse json string by hand. + if (typeof answer === 'string') { + answer = JSON.parse(answer); + } + if (Array.isArray(answer.completions)) { + if (me.parent.val().length == 0 && answer.completions.length > 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) { + answer.completions.forEach(function (suggestion) { + me.addSuggestion(suggestion, false); + }); + var firstSuggestion = answer.completions[0]; + var value = firstSuggestion.id || firstSuggestion.value; + me.parent.select.addToken(value, firstSuggestion.fieldLabel, firstSuggestion.type, true); + return; + } + answer.completions.forEach(function (suggestion) { + me.addSuggestion(suggestion); + }); + if (me.suggestions.childNodes.length == 0) { + if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) { + me.addSuggestion({ + id: null, + value: query, + fieldLabel: query, + type: '_no_match_', + completionDescription: me.parent.options.noMatchesCustomEntriesDescription, + completionLabel: null, + disabled: true + }); + } + else if (me.parent.options.noMatchesText) { + me.addSuggestion({ + id: null, + value: '_no_match_', + fieldLabel: me.parent.options.noMatchesText, + type: '_no_match_', + completionDescription: null, + completionLabel: null, + disabled: true + }); + } } - me.dispatchSuggestionSelectedEvent(element); } + }; + var suggestionsUri = me.options.suggestionsUriBuilder(query); + me.request.open('GET', suggestionsUri, true); + me.request.responseType = 'json'; + me.request.setRequestHeader('Content-type', 'application/json'); + me.request.send(); + }; + /** + * Adds a suggestion with the given text matching the users input to the dropdown. + * + * @param {string} suggestion - the metadata of the suggestion that should be added + * @param showSuggestions - if the suggestions box should be shown, default true + */ + class_4.prototype.addSuggestion = function (suggestion, showSuggestions) { + if (showSuggestions === void 0) { showSuggestions = true; } + var element = this.renderer(suggestion); + var value = suggestion.id || suggestion.value; + var text = suggestion.completionLabel || suggestion.fieldLabel; + element.dataset.value = value; + element.dataset.text = text; + element.dataset.tokenText = suggestion.fieldLabel; + if (suggestion.type != null) { + element.dataset.type = suggestion.type; } - else { - me.parent.select.clearCurrentInput(); - if (element.classList.contains('token-autocomplete-suggestion-active')) { - var multiSelect = me.parent.select; - multiSelect.removeTokenWithText(suggestion.fieldLabel); + var me = this; + element.addEventListener('click', function (_event) { + if (value == '_no_match_' || suggestion.disabled) { + return; + } + if (me.parent.options.selectMode == SelectModes.SINGLE) { + if (element.classList.contains('token-autocomplete-suggestion-active')) { + me.parent.select.clear(false); + } + else { + if (element.dataset.becomesToken !== 'false') { + me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false); + } + me.dispatchSuggestionSelectedEvent(element); + } } else { - if (element.dataset.becomesToken !== 'false') { - me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false); + me.parent.select.clearCurrentInput(); + if (element.classList.contains('token-autocomplete-suggestion-active')) { + var multiSelect = me.parent.select; + multiSelect.removeTokenWithText(suggestion.fieldLabel); + } + else { + if (element.dataset.becomesToken !== 'false') { + me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false); + } + me.dispatchSuggestionSelectedEvent(element); } - me.dispatchSuggestionSelectedEvent(element); } + me.clearSuggestions(); + me.hideSuggestions(); + }); + if (suggestion.disabled) { + element.classList.add('token-autocomplete-suggestion-disabled'); } - me.clearSuggestions(); - me.hideSuggestions(); - }); - if (this.container.querySelector('.token-autocomplete-token[data-value="' + value + '"]') !== null) { - element.classList.add('token-autocomplete-suggestion-active'); - } - this.suggestions.appendChild(element); - if (showSuggestions) { - this.showSuggestions(); - } - me.parent.log('added suggestion', suggestion); - }; - return class_4; - }()), + if (this.container.querySelector('.token-autocomplete-token[data-value="' + value + '"]') !== null) { + element.classList.add('token-autocomplete-suggestion-active'); + } + this.suggestions.appendChild(element); + if (showSuggestions) { + this.showSuggestions(); + } + me.parent.log('added suggestion', suggestion); + }; + return class_4; + }()), __setFunctionName(_b, "Autocomplete"), _b.defaultRenderer = function (suggestion) { var option = document.createElement('li'); @@ -1114,4 +1122,4 @@ var TokenAutocomplete = /** @class */ (function () { _b); return TokenAutocomplete; }()); -//# sourceMappingURL=token-autocomplete.js.map +//# sourceMappingURL=token-autocomplete.js.map \ No newline at end of file diff --git a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js.map b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js.map index 88d890ef9..a4d833bd7 100644 --- a/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js.map +++ b/src/main/resources/default/assets/tycho/libs/token-autocomplete/token-autocomplete.js.map @@ -1 +1 @@ -{"version":3,"file":"token-autocomplete.js","sourceRoot":"","sources":["../lib/token-autocomplete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAK,WAEJ;AAFD,WAAK,WAAW;IACZ,iDAAM,CAAA;IAAE,+CAAK,CAAA;IAAE,iDAAM,CAAA;AACzB,CAAC,EAFI,WAAW,KAAX,WAAW,QAEf;AAiED;IA4CI,2BAAY,OAAgB;QA1C5B,kBAAa,GAAG,WAAW,CAAC;QAC5B,cAAS,GAAG,OAAO,CAAC;QACpB,YAAO,GAAG,KAAK,CAAC;QAChB,WAAM,GAAG,SAAS,CAAC;QACnB,aAAQ,GAAG,WAAW,CAAC;QACvB,aAAQ,GAAG,WAAW,CAAC;QACvB,cAAS,GAAG,YAAY,CAAC;QACzB,YAAO,GAAG,QAAQ,CAAC;QAUnB,aAAQ,GAAY;YAChB,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,aAAa,EAAE,IAAI;YACnB,iCAAiC,EAAE,IAAI;YACvC,eAAe,EAAE,iBAAiB;YAClC,aAAa,EAAE,IAAI;YACnB,kBAAkB,EAAE,IAAI;YACxB,aAAa,EAAE,iBAAiB,CAAC,WAAW,CAAC,eAAe;YAC5D,cAAc,EAAE,EAAE;YAClB,UAAU,EAAE,WAAW,CAAC,KAAK;YAC7B,qBAAqB,EAAE,UAAU,KAAK;gBAClC,OAAO,IAAI,CAAC,cAAc,GAAG,SAAS,GAAG,KAAK,CAAA;YAClD,CAAC;YACD,kBAAkB,EAAE,iBAAiB,CAAC,YAAY,CAAC,eAAe;YA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;4BACD,EAAE,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC;yBAC/C;qBACJ;oBACD,EAAE,CAAC,gBAAgB,EAAE,CAAC;oBACtB,EAAE,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC,CAAC,CAAC;gBAEH,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,wCAAwC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;oBAChG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;iBACjE;gBAED,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,eAAe,EAAE;oBACjB,IAAI,CAAC,eAAe,EAAE,CAAC;iBAC1B;gBAED,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;YAClD,CAAC;YAeL,cAAC;QAAD,CAAC,AAzYqB;;QA4XX,kBAAe,GAAuB,UAAU,UAAsB;YACzE,IAAI,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,CAAC,WAAW,GAAG,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,UAAU,CAAC;YAEzE,IAAI,UAAU,CAAC,qBAAqB,EAAE;gBAClC,IAAI,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAClD,WAAW,CAAC,WAAW,GAAG,UAAU,CAAC,qBAAqB,CAAC;gBAC3D,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;gBACvE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;aACnC;YAED,OAAO,MAAM,CAAC;QAClB,CAAC;WAxYc,CAyYlB;IAKL,wBAAC;CAAA,AArqCD,IAqqCC","sourcesContent":["interface Token {\n value: string,\n text: string,\n type: string | null\n}\n\ninterface Suggestion {\n id: string | null,\n value: string,\n fieldLabel: string,\n type: string | null,\n completionLabel: string | null,\n completionDescription: string | null\n}\n\ninterface Options {\n name: string,\n selector: string,\n noMatchesText: string | null,\n noMatchesCustomEntriesDescription: string | null,\n placeholderText: string | null,\n initialTokens: Array | null,\n initialSuggestions: Array | null,\n tokenRenderer: TokenRenderer,\n selectMode: SelectModes,\n suggestionsUri: string,\n suggestionsUriBuilder: SuggestionUriBuilder,\n suggestionRenderer: SuggestionRenderer,\n minCharactersForSuggestion: number,\n allowCustomEntries: boolean,\n readonly: boolean,\n optional: boolean,\n enableTabulator: boolean,\n showSuggestionsOnFocus: boolean,\n requestDelay: number\n}\n\nenum SelectModes {\n SINGLE, MULTI, SEARCH\n}\n\ninterface SelectMode {\n addToken(suggestionValue: string | null, suggestionText: string | null, suggestionType: string | null, silent: boolean): void;\n\n handleInputAsValue(input: string): void;\n\n initEventListeners(): void;\n\n clear(silent: boolean): void;\n\n clearCurrentInput(): void;\n}\n\ninterface SingleSelect extends SelectMode {\n}\n\ninterface MultiSelect extends SelectMode {\n removeToken(token: HTMLSpanElement): void;\n\n removeLastToken(): void;\n\n removeTokenWithText(textContent: any): void;\n}\n\ninterface Autocomplete {\n suggestions: any;\n\n initEventListeners(): void;\n\n requestSuggestions(value: string): void;\n\n highlightSuggestionAtPosition(arg0: number): void;\n\n addSuggestion(suggestion: Suggestion, showSuggestions: boolean): void;\n\n clearSuggestions(): void;\n\n showSuggestions(): void;\n\n hideSuggestions(): void;\n\n loadSuggestions(): void;\n\n areSuggestionsDisplayed(): boolean;\n\n areSuggestionsActive(): boolean;\n\n highlightSuggestion(arg0: Element): void;\n\n dispatchSuggestionSelectedEvent(_suggestion: HTMLElement): void;\n}\n\ninterface TokenRenderer {\n (token: Token): HTMLElement;\n}\n\ninterface SuggestionRenderer {\n (suggestion: Suggestion): HTMLElement;\n}\n\ninterface SuggestionUriBuilder {\n (query: string): string;\n}\n\nclass TokenAutocomplete {\n\n KEY_BACKSPACE = 'Backspace';\n KEY_ENTER = 'Enter';\n KEY_TAB = 'Tab';\n KEY_UP = 'ArrowUp';\n KEY_DOWN = 'ArrowDown';\n KEY_LEFT = 'ArrowLeft';\n KEY_RIGHT = 'ArrowRight';\n KEY_ESC = 'Escape';\n\n options: Options;\n container: any;\n hiddenSelect: HTMLSelectElement;\n textInput: HTMLSpanElement;\n\n select: SelectMode;\n autocomplete: Autocomplete;\n\n defaults: Options = {\n name: '',\n selector: '',\n noMatchesText: null,\n noMatchesCustomEntriesDescription: null,\n placeholderText: 'enter some text',\n initialTokens: null,\n initialSuggestions: null,\n tokenRenderer: TokenAutocomplete.MultiSelect.defaultRenderer,\n suggestionsUri: '',\n selectMode: SelectModes.MULTI,\n suggestionsUriBuilder: function (query) {\n return this.suggestionsUri + '?query=' + query\n },\n suggestionRenderer: TokenAutocomplete.Autocomplete.defaultRenderer,\n minCharactersForSuggestion: 1,\n allowCustomEntries: true,\n readonly: false,\n optional: false,\n enableTabulator: true,\n showSuggestionsOnFocus: true,\n requestDelay: 200\n };\n log: any;\n\n constructor(options: Options) {\n this.options = {...this.defaults, ...options};\n\n let passedContainer = document.querySelector(this.options.selector);\n if (!passedContainer) {\n throw new Error('passed selector does not point to a DOM element.');\n }\n\n this.container = passedContainer;\n this.container.classList.add('token-autocomplete-container');\n\n if (!Array.isArray(this.options.initialTokens) && !Array.isArray(this.options.initialSuggestions)) {\n this.parseTokensAndSuggestions();\n }\n\n this.hiddenSelect = document.createElement('select');\n this.hiddenSelect.id = this.container.id + '-select';\n this.hiddenSelect.name = this.options.name;\n this.hiddenSelect.setAttribute('multiple', 'true');\n this.hiddenSelect.setAttribute('autocomplete', 'off');\n this.hiddenSelect.style.display = 'none';\n\n if (this.options.readonly && this.options.tokenRenderer === TokenAutocomplete.MultiSelect.defaultRenderer) {\n this.options.tokenRenderer = TokenAutocomplete.MultiSelect.defaultReadonlyRenderer;\n }\n\n this.textInput = document.createElement('span');\n this.textInput.id = this.container.id + '-input';\n this.textInput.classList.add('token-autocomplete-input');\n if (!this.options.readonly) {\n if (this.options.placeholderText != null) {\n this.textInput.dataset.placeholder = this.options.placeholderText;\n }\n\n this.textInput.contentEditable = 'true';\n this.textInput.addEventListener(\"paste\", function (event) {\n event.preventDefault();\n if (event.clipboardData) {\n // Normal handling for modern browsers\n const text = event.clipboardData?.getData(\"text/plain\");\n document.execCommand(\"insertHTML\", false, text);\n } else {\n // Fallback logic for IE11\n const globalText = window.clipboardData?.getData(\"Text\");\n const range = document.getSelection()?.getRangeAt(0);\n range?.insertNode(document.createTextNode(globalText));\n }\n });\n } else {\n this.container.classList.add('token-autocomplete-readonly');\n }\n this.container.appendChild(this.textInput);\n\n\n this.container.appendChild(this.hiddenSelect);\n this.addHiddenEmptyOption();\n\n if (this.options.selectMode == SelectModes.MULTI) {\n this.select = new TokenAutocomplete.MultiSelect(this);\n } else if (this.options.selectMode == SelectModes.SEARCH) {\n this.select = new TokenAutocomplete.SearchMultiSelect(this);\n } else if (this.options.selectMode == SelectModes.SINGLE) {\n this.hiddenSelect.removeAttribute('multiple');\n this.select = new TokenAutocomplete.SingleSelect(this);\n }\n this.autocomplete = new TokenAutocomplete.Autocomplete(this);\n\n this.select.initEventListeners();\n this.autocomplete.initEventListeners();\n\n this.debug(false);\n\n if (Array.isArray(this.options.initialTokens)) {\n this.val(this.options.initialTokens);\n }\n\n this.container.tokenAutocomplete = this as TokenAutocomplete;\n\n if (this.options.selectMode == SelectModes.SINGLE && !this.options.optional && this.val().length == 0) {\n this.autocomplete.loadSuggestions();\n }\n }\n\n /**\n * Searches the element given as a container for option elements and creates active tokens (when the option is marked selected)\n * and suggestions (all options found) from these. During this all found options are removed from the DOM.\n */\n parseTokensAndSuggestions() {\n let initialTokens: Array = [];\n let initialSuggestions: Array = [];\n\n let options: NodeListOf = this.container.querySelectorAll('option');\n\n let me = this;\n options.forEach(function (option) {\n if (option.text != null) {\n if (option.hasAttribute('selected')) {\n initialTokens.push({value: option.value, text: option.text, type: null});\n }\n initialSuggestions.push({\n id: null,\n value: option.value,\n fieldLabel: option.text,\n type: null,\n completionDescription: option.dataset.description || null,\n completionLabel: null\n });\n }\n me.container.removeChild(option);\n });\n\n if (initialSuggestions.length > 0) {\n this.options.initialSuggestions = initialSuggestions;\n if (!this.options.optional && initialTokens.length == 0) {\n let firstSuggestion = initialSuggestions[0];\n initialTokens.push({\n value: firstSuggestion.value, text: firstSuggestion.fieldLabel, type: firstSuggestion.type\n });\n }\n }\n\n if (initialTokens.length > 0) {\n this.options.initialTokens = initialTokens;\n }\n }\n\n /**\n * Clears the currently present tokens and creates new ones from the given input value, returns new tokens afterwards.\n *\n * The current tokens are only overwritten (cleared and added) when a value parameter is given.\n * In addition to the possibility of setting the value of the input this method also returns the values of all present tokens.\n *\n * @param {(Array|Token)} value - either the name of a single token or a list of tokens to create\n * @param {boolean} silent - whether appropriate events should be triggered when changing tokens or not\n *\n * @returns an array of the values of all current (after update) tokens of the input field\n */\n val(value: Array | Token | null = null, silent: boolean = false): Array {\n if (typeof value !== 'undefined' && value !== null) {\n this.select.clear(silent);\n this.addToken(value, silent);\n }\n\n let tokens: Array = [];\n this.hiddenSelect.querySelectorAll('option').forEach(option => {\n if (option.dataset.value != null && option.dataset.value !== \"\") {\n tokens.push(option.dataset.value);\n }\n });\n return tokens;\n }\n\n\n /**\n * Adds the given tokens to the field.\n *\n * The current tokens are only added when a value parameter is given.\n *\n * @param {(Array|Token)} value - either the name of a single token or a list of tokens to create\n * @param {boolean} silent - whether appropriate events should be triggered when changing tokens or not\n */\n addToken(value: Array | Token, silent: boolean = false) {\n if (Array.isArray(value)) {\n let me = this;\n value.forEach(function (token) {\n if (typeof token === 'object') {\n me.select.addToken(token.value, token.text, token.type, silent);\n }\n });\n } else {\n this.select.addToken(value.value, value.text, value.type, silent);\n }\n }\n\n /**\n * Returns the current text the user has input which is not converted into a token.\n */\n getCurrentInput() {\n return this.textInput.textContent || '';\n }\n\n setCurrentInput(input: string, silent: boolean) {\n this.textInput.textContent = input;\n\n if (silent) {\n return;\n }\n\n this.container.dispatchEvent(new CustomEvent('query-changed', {\n detail: {\n query: input\n }\n }));\n }\n\n addHiddenOption(tokenValue: string, tokenText: string, tokenType: string | null, isLiveEntry: boolean = false) {\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n let _emptyToken = this.hiddenSelect.querySelector('.empty-token');\n if (_emptyToken) {\n this.hiddenSelect.removeChild(_emptyToken);\n }\n let _existingLiveEntry = this.hiddenSelect.querySelector('.live-entry');\n if (_existingLiveEntry) {\n this.hiddenSelect.removeChild(_existingLiveEntry);\n }\n let _existingOption = this.findOptionWithValue(tokenValue);\n if (_existingOption) {\n this.hiddenSelect.removeChild(_existingOption);\n }\n const option = document.createElement('option');\n option.text = tokenText;\n option.value = tokenValue;\n option.selected = true;\n option.dataset.text = tokenText;\n option.dataset.value = tokenValue;\n if (tokenType != null) {\n option.dataset.type = tokenType;\n }\n if (isLiveEntry) {\n option.classList.add('live-entry');\n }\n this.hiddenSelect.add(option);\n }\n\n findOptionWithValue(optionValue: string) {\n for (let i = 0; i < this.hiddenSelect.options.length; i++) {\n let option = this.hiddenSelect.options[i];\n if (option.value === optionValue) {\n return option;\n }\n }\n return null;\n }\n\n addHiddenEmptyOption() {\n let _emptyToken = this.hiddenSelect.querySelector('.empty-token');\n if (_emptyToken) {\n _emptyToken.setAttribute('selected', 'true');\n } else {\n const _newOption = document.createElement('option');\n _newOption.text = '';\n _newOption.value = '';\n _newOption.selected = true;\n _newOption.classList.add('empty-token');\n this.hiddenSelect.add(_newOption);\n }\n }\n\n setPlaceholderText(placeholderText: string | undefined) {\n this.textInput.dataset.placeholder = placeholderText;\n }\n\n debug(state: boolean) {\n if (state) {\n this.log = console.log.bind(window.console);\n } else {\n this.log = function () {\n // Intentionally left empty to only log when debugging is enabled.\n }\n }\n }\n\n static MultiSelect = class implements MultiSelect {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n renderer: TokenRenderer;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n this.renderer = parent.options.tokenRenderer;\n }\n\n clearCurrentInput(): void {\n this.parent.textInput.textContent = '';\n }\n\n initEventListeners(): void {\n const me = this;\n const parent = this.parent;\n if (parent.options.readonly) {\n return;\n }\n\n parent.textInput.addEventListener('compositionend', function (event) {\n // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers\n let inputString = event.data;\n if (inputString.charAt(inputString.length - 1) === \"\\n\") {\n event.preventDefault();\n me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'));\n }\n })\n\n parent.textInput.addEventListener('keydown', function (event) {\n if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) {\n event.preventDefault();\n\n let highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n\n if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) {\n highlightedSuggestion = parent.autocomplete.suggestions.firstChild;\n }\n\n me.handleInput(highlightedSuggestion);\n } else if (parent.getCurrentInput() === '' && event.key == parent.KEY_BACKSPACE) {\n event.preventDefault();\n me.removeLastToken();\n }\n if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) {\n event.preventDefault();\n }\n });\n }\n\n handleInput(highlightedSuggestion: any): void {\n if (highlightedSuggestion !== null) {\n this.clearCurrentInput();\n if (highlightedSuggestion.classList.contains('token-autocomplete-suggestion-active')) {\n this.removeTokenWithText(highlightedSuggestion.dataset.tokenText);\n } else {\n if (highlightedSuggestion.dataset.becomesToken !== 'false') {\n this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false);\n }\n this.parent.autocomplete.dispatchSuggestionSelectedEvent(highlightedSuggestion);\n }\n } else {\n this.handleInputAsValue(this.parent.getCurrentInput());\n }\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n }\n\n /**\n * Adds the current user input as a net token and resets the input area so new text can be entered.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string): void {\n if (input != '' && this.parent.options.allowCustomEntries) {\n this.clearCurrentInput();\n this.addToken(input, input, null);\n return;\n }\n if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') {\n this.parent.autocomplete.suggestions.firstChild.click();\n } else {\n this.clearCurrentInput();\n }\n }\n\n /**\n * Adds a token with the specified name to the list of currently present tokens displayed to the user and the hidden select.\n *\n * @param {string} tokenValue - the actual value of the token to create\n * @param {string} tokenText - the name of the token to create\n * @param {string} tokenType - the type of the token to create\n * @param {boolean} silent - whether an appropriate event should be triggered\n */\n addToken(tokenValue: string | null, tokenText: string | null, tokenType: string | null, silent: boolean = false) {\n if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') {\n return;\n }\n\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n\n this.parent.addHiddenOption(tokenValue, tokenText, tokenType);\n\n let addedToken = {\n value: tokenValue,\n text: tokenText,\n type: tokenType\n };\n\n let element = this.renderer(addedToken);\n\n let me = this;\n element.querySelector('.token-autocomplete-token-delete')?.addEventListener('click', function () {\n me.removeToken(element);\n });\n\n this.container.insertBefore(element, this.parent.textInput);\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n added: addedToken\n }\n }));\n }\n\n this.parent.log('added token', addedToken);\n }\n\n /**\n * Completely clears the currently present tokens from the field.\n */\n clear(silent: boolean = false) {\n let tokens: NodeListOf = this.container.querySelectorAll('.token-autocomplete-token');\n\n let me = this;\n tokens.forEach(function (token) {\n me.removeToken(token, silent);\n });\n }\n\n /**\n * Removes the last token in the list of currently present token. This is the last added token next to the input field.\n */\n removeLastToken() {\n let tokens = this.container.querySelectorAll('.token-autocomplete-token');\n let token = tokens[tokens.length - 1];\n if (token) {\n this.removeToken(token);\n }\n }\n\n /**\n * Removes the specified token from the list of currently present tokens.\n *\n * @param {Element} token - the token to remove\n * @param {boolean} silent - whether an appropriate event should be triggered\n */\n removeToken(token: HTMLElement, silent: boolean = false) {\n this.container.removeChild(token);\n\n let tokenText = token.dataset.text;\n let hiddenOption = this.parent.hiddenSelect.querySelector('option[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]');\n hiddenOption?.parentElement?.removeChild(hiddenOption);\n\n let addedToken = {\n value: token.dataset.value,\n text: tokenText,\n type: token.dataset.type || null\n };\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n removed: addedToken\n }\n }));\n }\n\n if (this.parent.val().length === 0) {\n this.parent.addHiddenEmptyOption();\n }\n\n this.parent.log('removed token', token.textContent);\n }\n\n removeTokenWithText(tokenText: string | null) {\n if (tokenText === null) {\n return;\n }\n let token = this.container.querySelector('.token-autocomplete-token[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]');\n if (token !== null) {\n this.removeToken(token);\n }\n }\n\n static defaultRenderer: TokenRenderer = function (token: Token): HTMLElement {\n const chip = document.createElement('span');\n chip.classList.add('token-autocomplete-token');\n chip.dataset.text = token.text;\n chip.dataset.value = token.value;\n if (token.type != null) {\n chip.dataset.type = token.type;\n }\n chip.textContent = token.text;\n\n let deleteToken = document.createElement('span');\n deleteToken.classList.add('token-autocomplete-token-delete');\n deleteToken.textContent = '\\u00D7';\n chip.appendChild(deleteToken);\n\n return chip;\n }\n\n static defaultReadonlyRenderer: TokenRenderer = function (token: Token): HTMLElement {\n const chip = document.createElement('span');\n chip.classList.add('token-autocomplete-token');\n chip.dataset.text = token.text;\n chip.dataset.value = token.value;\n if (token.type != null) {\n chip.dataset.type = token.type;\n }\n chip.textContent = token.text;\n\n return chip;\n }\n }\n\n static SingleSelect = class implements SingleSelect {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n renderer: TokenRenderer;\n previousValue: any;\n previousText: any;\n previousType: any;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n\n this.container.classList.add('token-autocomplete-singleselect');\n this.parent.textInput.tabIndex = 0;\n if (this.options.optional) {\n let deleteToken = document.createElement('span');\n deleteToken.classList.add('token-singleselect-token-delete');\n deleteToken.textContent = '\\u00D7';\n this.container.appendChild(deleteToken);\n }\n }\n\n /**\n * Clears the current user input so new text can be entered.\n *\n * @param {boolean} silent - whether an appropriate event should be triggered\n * @param {boolean} keepPreviousValue - if true, the previous value will be stored and shown as a placeholder\n */\n clear(silent: boolean, keepPreviousValue = true): void {\n if (this.options.readonly) {\n return;\n }\n let me = this;\n let tokenText = me.parent.textInput.textContent;\n let hiddenOption = me.parent.hiddenSelect.querySelector('option[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]') as HTMLElement;\n if (me.options.optional) {\n this.container.classList.remove('optional-singleselect-with-value');\n }\n if (keepPreviousValue) {\n me.previousValue = hiddenOption?.dataset.value;\n me.previousText = hiddenOption?.dataset.text;\n me.previousType = hiddenOption?.dataset.type;\n if (hiddenOption == null && me.options.allowCustomEntries) {\n me.previousValue = tokenText;\n me.previousText = tokenText;\n }\n if (me.previousText && me.previousText !== '') {\n me.parent.textInput.dataset.placeholder = me.previousText;\n }\n } else {\n // We should reset these fields, so they are not used to restore the previously selected value\n // when the focusout event is handled after the click event on the suggestion.\n delete me.previousValue;\n delete me.previousText;\n delete me.previousType;\n if (me.parent.options.placeholderText != null) {\n me.parent.textInput.dataset.placeholder = me.parent.options.placeholderText;\n }\n }\n hiddenOption?.parentElement?.removeChild(hiddenOption);\n me.parent.addHiddenEmptyOption();\n me.parent.textInput.textContent = '';\n me.parent.textInput.contentEditable = 'true';\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n }\n }));\n }\n }\n\n /**\n * Adds the current user input as a net token and resets the input area so new text can be entered.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string): void {\n if (input != '' && this.parent.options.allowCustomEntries) {\n this.clearCurrentInput();\n this.addToken(input, input, null, false);\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n return;\n }\n if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') {\n this.parent.autocomplete.suggestions.firstChild.click();\n return;\n }\n this.clear(true, false);\n }\n\n clearCurrentInput(): void {\n this.clear(true);\n }\n\n addToken(tokenValue: string | null, tokenText: string | null, tokenType: string | null, silent: boolean): void {\n if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') {\n return;\n }\n\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n\n this.clear(true, false);\n this.parent.textInput.textContent = tokenText;\n this.parent.textInput.contentEditable = 'false';\n this.parent.textInput.blur();\n if (this.options.optional && tokenText !== '') {\n this.container.classList.add('optional-singleselect-with-value');\n }\n\n this.parent.addHiddenOption(tokenValue, tokenText, tokenType);\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n added: {\n value: tokenValue,\n text: tokenText,\n type: tokenType\n }\n }\n }));\n }\n }\n\n initEventListeners(): void {\n const me = this;\n const parent = this.parent;\n if (parent.options.readonly) {\n return;\n }\n\n parent.textInput.addEventListener('compositionend', function (event) {\n // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers\n let inputString = event.data;\n if (inputString.charAt(inputString.length - 1) === \"\\n\") {\n event.preventDefault();\n me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'));\n }\n })\n\n parent.textInput.addEventListener('keydown', function (event) {\n if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) {\n event.preventDefault();\n\n let highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n\n if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) {\n highlightedSuggestion = parent.autocomplete.suggestions.firstChild;\n }\n\n me.handleInput(highlightedSuggestion);\n }\n if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) {\n event.preventDefault();\n }\n });\n\n if (parent.options.allowCustomEntries) {\n parent.textInput.addEventListener('keyup', function (event) {\n if (event.key != parent.KEY_ENTER && event.key != parent.KEY_TAB && event.key != parent.KEY_DOWN && event.key != parent.KEY_UP) {\n event.preventDefault();\n parent.addHiddenOption(parent.getCurrentInput(), parent.getCurrentInput(), null, true);\n }\n });\n }\n\n function focusInput() {\n if (!parent.autocomplete.areSuggestionsDisplayed() && parent.options.showSuggestionsOnFocus) {\n parent.autocomplete.showSuggestions();\n parent.autocomplete.loadSuggestions();\n }\n // move the cursor into the editable div\n const selection = window.getSelection();\n const range = document.createRange();\n selection?.removeAllRanges();\n range.selectNodeContents(parent.textInput);\n range.collapse(false);\n selection?.addRange(range);\n parent.textInput.focus();\n }\n\n parent.textInput.addEventListener('click', function () {\n focusInput();\n });\n\n parent.textInput.addEventListener('focusout', function () {\n // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling.\n // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input.\n // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected.\n // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example)\n setTimeout(function () {\n if (parent.autocomplete.areSuggestionsActive()) {\n return;\n }\n const input = me.parent.getCurrentInput();\n if (me.parent.val().length !== 0 && me.parent.val()[0] !== '') {\n return;\n }\n if (input != '') {\n me.handleInputAsValue(input);\n return;\n }\n if (me.previousValue) {\n me.addToken(me.previousValue, me.previousText, me.previousType, true);\n }\n }, 0);\n\n });\n parent.container.querySelector('.token-singleselect-token-delete')?.addEventListener('click', function () {\n me.clear(false, false);\n });\n }\n\n handleInput(highlightedSuggestion: any): void {\n if (highlightedSuggestion !== null) {\n this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false);\n } else {\n this.handleInputAsValue(this.parent.getCurrentInput());\n }\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n }\n }\n\n static SearchMultiSelect = class extends TokenAutocomplete.MultiSelect {\n /**\n * Instead of adding the custom user input as a token and handling it as a filter we let it remain in the input\n * area and instead send an event so the user search request can be handled / executed.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string) {\n this.container.dispatchEvent(new CustomEvent('query-changed', {\n detail: {\n query: input\n }\n }));\n }\n }\n\n static Autocomplete = class implements Autocomplete {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n suggestions: HTMLUListElement;\n renderer: SuggestionRenderer;\n request: XMLHttpRequest | null;\n timeout: number | undefined;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n this.renderer = parent.options.suggestionRenderer;\n\n this.suggestions = document.createElement('ul');\n this.suggestions.id = this.container.id + '-suggestions';\n this.suggestions.classList.add('token-autocomplete-suggestions');\n\n this.container.appendChild(this.suggestions);\n }\n\n initEventListeners() {\n let me = this;\n if (me.parent.options.readonly) {\n return;\n }\n me.parent.textInput.addEventListener('keyup', function (event) {\n if (event.key == me.parent.KEY_ESC) {\n me.hideSuggestions();\n me.parent.textInput.blur();\n return;\n }\n if (event.key == me.parent.KEY_UP && me.suggestions.childNodes.length > 0) {\n event.preventDefault();\n let highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n if (highlightedSuggestion == null) {\n // highlight last entry and scroll to bottom\n me.highlightSuggestionAtPosition(me.suggestions.childNodes.length - 1);\n me.suggestions.scrollTop = me.suggestions.scrollHeight;\n return;\n }\n let aboveSuggestion = highlightedSuggestion.previousSibling;\n if (aboveSuggestion != null) {\n // if the suggestions is above the scroll position, scroll to the suggestion\n let suggestionTop = (aboveSuggestion as HTMLElement).offsetTop;\n if (me.suggestions.scrollTop > suggestionTop) {\n me.suggestions.scrollTop = suggestionTop;\n }\n me.highlightSuggestion(aboveSuggestion as Element);\n } else {\n highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n }\n return;\n }\n if (event.key == me.parent.KEY_DOWN && me.suggestions.childNodes.length > 0) {\n event.preventDefault();\n let highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n if (highlightedSuggestion == null) {\n // highlight first entry and scroll to top\n me.highlightSuggestionAtPosition(0);\n me.suggestions.scrollTop = 0;\n return;\n }\n let belowSuggestion = highlightedSuggestion?.nextSibling;\n if (belowSuggestion != null) {\n // if the suggestions is not completely visible, scroll until the suggestion is at the bottom\n let suggestionBottom = (belowSuggestion as HTMLElement).offsetTop + (belowSuggestion as HTMLElement).offsetHeight;\n if (me.suggestions.scrollTop + me.suggestions.clientHeight < suggestionBottom) {\n me.suggestions.scrollTop = suggestionBottom - me.suggestions.clientHeight;\n }\n me.highlightSuggestion(belowSuggestion as Element);\n } else {\n highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n }\n return;\n }\n if (event.key == me.parent.KEY_LEFT || event.key == me.parent.KEY_RIGHT || event.key == me.parent.KEY_ENTER || event.key == me.parent.KEY_TAB) {\n // We don't want to re-trigger the autocompletion when the user navigates the cursor inside the input.\n return;\n }\n me.loadSuggestions();\n });\n me.parent.textInput.addEventListener('focusout', function () {\n // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling.\n // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input.\n // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected.\n // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example)\n setTimeout(function () {\n if (me.areSuggestionsActive()) {\n return;\n }\n me.hideSuggestions();\n }, 0);\n });\n me.parent.textInput.addEventListener('focusin', function () {\n if (me.options.showSuggestionsOnFocus) {\n me.loadSuggestions();\n me.showSuggestions();\n }\n });\n }\n\n loadSuggestions() {\n let me = this;\n let value = me.parent.getCurrentInput();\n\n if (me.parent.options.selectMode == SelectModes.SINGLE) {\n if (!me.parent.textInput.isContentEditable) {\n me.parent.select.clear(true);\n value = \"\";\n }\n } else if (value.length < me.parent.options.minCharactersForSuggestion) {\n me.clearSuggestions();\n me.hideSuggestions();\n return;\n }\n if (me.parent.options.suggestionsUri.length > 0) {\n me.requestSuggestions(value);\n return;\n }\n if (Array.isArray(me.parent.options.initialSuggestions)) {\n me.clearSuggestions();\n me.parent.options.initialSuggestions.forEach(function (suggestion) {\n if (typeof suggestion !== 'object') {\n // The suggestion is of wrong type and therefore ignored.\n return;\n }\n let text = suggestion.fieldLabel;\n if (value.length == 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) {\n me.addSuggestion(suggestion, false);\n } else if (value.localeCompare(text.slice(0, value.length), undefined, {sensitivity: 'base'}) === 0) {\n // The suggestion starts with the query text the user entered and will be displayed.\n me.addSuggestion(suggestion);\n }\n });\n if (me.suggestions.childNodes.length == 0) {\n if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) {\n me.addSuggestion({\n id: null,\n value: value,\n fieldLabel: value,\n type: '_no_match_',\n completionDescription: me.parent.options.noMatchesCustomEntriesDescription,\n completionLabel: null\n });\n\n } else if (me.parent.options.noMatchesText) {\n me.addSuggestion({\n id: null,\n value: '_no_match_',\n fieldLabel: me.parent.options.noMatchesText,\n type: '_no_match_',\n completionDescription: null,\n completionLabel: null\n });\n }\n }\n }\n }\n\n /**\n * Hides the suggestions dropdown from the user.\n */\n hideSuggestions() {\n // as the suggestions will be re-shown if a pending request is executed, we abort them if we want to hide\n this.abortPendingRequest();\n this.suggestions.style.display = '';\n\n let _highlightedSuggestions = this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted');\n _highlightedSuggestions.forEach(function (_suggestion) {\n _suggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n }\n\n /**\n * Shows the suggestions dropdown to the user.\n */\n showSuggestions() {\n this.suggestions.style.display = 'block';\n }\n\n areSuggestionsDisplayed() {\n return this.suggestions.style.display === 'block';\n }\n\n highlightSuggestionAtPosition(index: number) {\n let _suggestions = this.suggestions.querySelectorAll('li');\n _suggestions.forEach(function (_suggestion) {\n _suggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n _suggestions[index].classList.add('token-autocomplete-suggestion-highlighted');\n }\n\n highlightSuggestion(_suggestion: Element) {\n this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted').forEach(function (_highlightedSuggestion) {\n _highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n _suggestion.classList.add('token-autocomplete-suggestion-highlighted');\n }\n\n /**\n * Checks for the presence of a suggestion that is currently clicked via mouse (active).\n */\n areSuggestionsActive() {\n return !!this.suggestions.querySelector('li:active');\n }\n\n /**\n * Removes all previous suggestions from the dropdown.\n */\n clearSuggestions() {\n this.abortPendingRequest();\n this.suggestions.innerHTML = '';\n }\n\n /**\n * Aborts currently in progress or scheduled suggestions requests.\n */\n abortPendingRequest() {\n this.request?.abort();\n clearTimeout(this.timeout);\n }\n\n /**\n * Loads suggestions matching the given query from the rest service behind the URI given as an option while initializing the field.\n *\n * @param query the query to search suggestions for\n */\n requestSuggestions(query: string) {\n let me = this;\n clearTimeout(me.timeout);\n if (!me.timeout) {\n me.debouncedRequestSuggestions.call(me, query);\n me.timeout = window.setTimeout(function () {\n delete me.timeout;\n }, me.parent.options.requestDelay);\n } else {\n me.timeout = window.setTimeout(function () {\n delete me.timeout;\n me.debouncedRequestSuggestions.call(me, query);\n }, me.parent.options.requestDelay);\n }\n }\n\n dispatchSuggestionSelectedEvent(_suggestion: HTMLElement) {\n _suggestion.dispatchEvent(new CustomEvent('suggestion-selected', {\n detail: {\n value: _suggestion.dataset.value,\n text: _suggestion.dataset.text,\n type: _suggestion.dataset.type || null\n }\n }));\n }\n\n debouncedRequestSuggestions(query: string) {\n let me = this;\n\n if (me.request != null && me.request.readyState) {\n me.request.abort();\n }\n\n me.request = new XMLHttpRequest();\n me.request.onload = function () {\n me.request = null;\n\n me.clearSuggestions();\n\n let answer = this.response;\n // IE 11 doesn't properly respect content type header, need to parse json string by hand.\n if (typeof answer === 'string') {\n answer = JSON.parse(answer);\n }\n\n if (Array.isArray(answer.completions)) {\n if (me.parent.val().length == 0 && answer.completions.length > 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) {\n answer.completions.forEach(function (suggestion: Suggestion) {\n me.addSuggestion(suggestion, false);\n });\n let firstSuggestion = answer.completions[0] as Suggestion;\n let value = firstSuggestion.id || firstSuggestion.value;\n me.parent.select.addToken(value, firstSuggestion.fieldLabel, firstSuggestion.type, true);\n return;\n }\n answer.completions.forEach(function (suggestion: Suggestion) {\n me.addSuggestion(suggestion);\n });\n if (me.suggestions.childNodes.length == 0) {\n if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) {\n me.addSuggestion({\n id: null,\n value: query,\n fieldLabel: query,\n type: '_no_match_',\n completionDescription: me.parent.options.noMatchesCustomEntriesDescription,\n completionLabel: null\n });\n\n } else if (me.parent.options.noMatchesText) {\n me.addSuggestion({\n id: null,\n value: '_no_match_',\n fieldLabel: me.parent.options.noMatchesText,\n type: '_no_match_',\n completionDescription: null,\n completionLabel: null\n });\n }\n }\n }\n };\n let suggestionsUri = me.options.suggestionsUriBuilder(query);\n me.request.open('GET', suggestionsUri, true);\n me.request.responseType = 'json';\n me.request.setRequestHeader('Content-type', 'application/json');\n me.request.send();\n }\n\n /**\n * Adds a suggestion with the given text matching the users input to the dropdown.\n *\n * @param {string} suggestion - the metadata of the suggestion that should be added\n * @param showSuggestions - if the suggestions box should be shown, default true\n */\n addSuggestion(suggestion: Suggestion, showSuggestions = true) {\n let element = this.renderer(suggestion);\n\n let value = suggestion.id || suggestion.value;\n let text = suggestion.completionLabel || suggestion.fieldLabel;\n\n element.dataset.value = value;\n element.dataset.text = text;\n element.dataset.tokenText = suggestion.fieldLabel;\n if (suggestion.type != null) {\n element.dataset.type = suggestion.type;\n }\n\n let me = this;\n element.addEventListener('click', function (_event: Event) {\n if (value == '_no_match_') {\n return;\n }\n if (me.parent.options.selectMode == SelectModes.SINGLE) {\n if (element.classList.contains('token-autocomplete-suggestion-active')) {\n me.parent.select.clear(false);\n } else {\n if (element.dataset.becomesToken !== 'false') {\n me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false);\n }\n me.dispatchSuggestionSelectedEvent(element);\n }\n } else {\n me.parent.select.clearCurrentInput();\n if (element.classList.contains('token-autocomplete-suggestion-active')) {\n let multiSelect = me.parent.select as MultiSelect;\n multiSelect.removeTokenWithText(suggestion.fieldLabel);\n } else {\n if (element.dataset.becomesToken !== 'false') {\n me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false);\n }\n me.dispatchSuggestionSelectedEvent(element);\n }\n }\n me.clearSuggestions();\n me.hideSuggestions();\n });\n\n if (this.container.querySelector('.token-autocomplete-token[data-value=\"' + value + '\"]') !== null) {\n element.classList.add('token-autocomplete-suggestion-active');\n }\n\n this.suggestions.appendChild(element);\n if (showSuggestions) {\n this.showSuggestions();\n }\n\n me.parent.log('added suggestion', suggestion);\n }\n\n static defaultRenderer: SuggestionRenderer = function (suggestion: Suggestion): HTMLElement {\n let option = document.createElement('li');\n option.textContent = suggestion.completionLabel || suggestion.fieldLabel;\n\n if (suggestion.completionDescription) {\n let description = document.createElement('small');\n description.textContent = suggestion.completionDescription;\n description.classList.add('token-autocomplete-suggestion-description');\n option.appendChild(description);\n }\n\n return option;\n }\n }\n\n static escapeQuotes(text: string | null | undefined): string {\n return text?.replace(/\\x22/g, '\\\\\\x22') ?? '';\n }\n}\n"]} +{"version":3,"file":"token-autocomplete.js","sourceRoot":"","sources":["../lib/token-aut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;oBACtB,EAAE,CAAC,eAAe,EAAE,CAAC;gBACzB,CAAC,CAAC,CAAC;gBAEH,IAAI,UAAU,CAAC,QAAQ,EAAE;oBACrB,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;iBACnE;gBAED,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,wCAAwC,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;oBAChG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;iBACjE;gBAED,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,eAAe,EAAE;oBACjB,IAAI,CAAC,eAAe,EAAE,CAAC;iBAC1B;gBAED,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;YAClD,CAAC;YAeL,cAAC;QAAD,CAAC,AAjZqB;;QAoYX,kBAAe,GAAuB,UAAU,UAAsB;YACzE,IAAI,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,CAAC,WAAW,GAAG,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,UAAU,CAAC;YAEzE,IAAI,UAAU,CAAC,qBAAqB,EAAE;gBAClC,IAAI,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAClD,WAAW,CAAC,WAAW,GAAG,UAAU,CAAC,qBAAqB,CAAC;gBAC3D,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;gBACvE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;aACnC;YAED,OAAO,MAAM,CAAC;QAClB,CAAC;WAhZc,CAiZlB;IAKL,wBAAC;CAAA,AA9qCD,IA8qCC","sourcesContent":["interface Token {\n value: string,\n text: string,\n type: string | null\n}\n\ninterface Suggestion {\n id: string | null,\n value: string,\n fieldLabel: string,\n type: string | null,\n completionLabel: string | null,\n completionDescription: string | null,\n disabled: boolean | null\n}\n\ninterface Options {\n name: string,\n selector: string,\n noMatchesText: string | null,\n noMatchesCustomEntriesDescription: string | null,\n placeholderText: string | null,\n initialTokens: Array | null,\n initialSuggestions: Array | null,\n tokenRenderer: TokenRenderer,\n selectMode: SelectModes,\n suggestionsUri: string,\n suggestionsUriBuilder: SuggestionUriBuilder,\n suggestionRenderer: SuggestionRenderer,\n minCharactersForSuggestion: number,\n allowCustomEntries: boolean,\n readonly: boolean,\n optional: boolean,\n enableTabulator: boolean,\n showSuggestionsOnFocus: boolean,\n requestDelay: number\n}\n\nenum SelectModes {\n SINGLE, MULTI, SEARCH\n}\n\ninterface SelectMode {\n addToken(suggestionValue: string | null, suggestionText: string | null, suggestionType: string | null, silent: boolean): void;\n\n handleInputAsValue(input: string): void;\n\n initEventListeners(): void;\n\n clear(silent: boolean): void;\n\n clearCurrentInput(): void;\n}\n\ninterface SingleSelect extends SelectMode {\n}\n\ninterface MultiSelect extends SelectMode {\n removeToken(token: HTMLSpanElement): void;\n\n removeLastToken(): void;\n\n removeTokenWithText(textContent: any): void;\n}\n\ninterface Autocomplete {\n suggestions: any;\n\n initEventListeners(): void;\n\n requestSuggestions(value: string): void;\n\n highlightSuggestionAtPosition(arg0: number): void;\n\n addSuggestion(suggestion: Suggestion, showSuggestions: boolean): void;\n\n clearSuggestions(): void;\n\n showSuggestions(): void;\n\n hideSuggestions(): void;\n\n loadSuggestions(): void;\n\n areSuggestionsDisplayed(): boolean;\n\n areSuggestionsActive(): boolean;\n\n highlightSuggestion(arg0: Element): void;\n\n dispatchSuggestionSelectedEvent(_suggestion: HTMLElement): void;\n}\n\ninterface TokenRenderer {\n (token: Token): HTMLElement;\n}\n\ninterface SuggestionRenderer {\n (suggestion: Suggestion): HTMLElement;\n}\n\ninterface SuggestionUriBuilder {\n (query: string): string;\n}\n\nclass TokenAutocomplete {\n\n KEY_BACKSPACE = 'Backspace';\n KEY_ENTER = 'Enter';\n KEY_TAB = 'Tab';\n KEY_UP = 'ArrowUp';\n KEY_DOWN = 'ArrowDown';\n KEY_LEFT = 'ArrowLeft';\n KEY_RIGHT = 'ArrowRight';\n KEY_ESC = 'Escape';\n\n options: Options;\n container: any;\n hiddenSelect: HTMLSelectElement;\n textInput: HTMLSpanElement;\n\n select: SelectMode;\n autocomplete: Autocomplete;\n\n defaults: Options = {\n name: '',\n selector: '',\n noMatchesText: null,\n noMatchesCustomEntriesDescription: null,\n placeholderText: 'enter some text',\n initialTokens: null,\n initialSuggestions: null,\n tokenRenderer: TokenAutocomplete.MultiSelect.defaultRenderer,\n suggestionsUri: '',\n selectMode: SelectModes.MULTI,\n suggestionsUriBuilder: function (query) {\n return this.suggestionsUri + '?query=' + query\n },\n suggestionRenderer: TokenAutocomplete.Autocomplete.defaultRenderer,\n minCharactersForSuggestion: 1,\n allowCustomEntries: true,\n readonly: false,\n optional: false,\n enableTabulator: true,\n showSuggestionsOnFocus: true,\n requestDelay: 200\n };\n log: any;\n\n constructor(options: Options) {\n this.options = {...this.defaults, ...options};\n\n let passedContainer = document.querySelector(this.options.selector);\n if (!passedContainer) {\n throw new Error('passed selector does not point to a DOM element.');\n }\n\n this.container = passedContainer;\n this.container.classList.add('token-autocomplete-container');\n\n if (!Array.isArray(this.options.initialTokens) && !Array.isArray(this.options.initialSuggestions)) {\n this.parseTokensAndSuggestions();\n }\n\n this.hiddenSelect = document.createElement('select');\n this.hiddenSelect.id = this.container.id + '-select';\n this.hiddenSelect.name = this.options.name;\n this.hiddenSelect.setAttribute('multiple', 'true');\n this.hiddenSelect.setAttribute('autocomplete', 'off');\n this.hiddenSelect.style.display = 'none';\n\n if (this.options.readonly && this.options.tokenRenderer === TokenAutocomplete.MultiSelect.defaultRenderer) {\n this.options.tokenRenderer = TokenAutocomplete.MultiSelect.defaultReadonlyRenderer;\n }\n\n this.textInput = document.createElement('span');\n this.textInput.id = this.container.id + '-input';\n this.textInput.classList.add('token-autocomplete-input');\n if (!this.options.readonly) {\n if (this.options.placeholderText != null) {\n this.textInput.dataset.placeholder = this.options.placeholderText;\n }\n\n this.textInput.contentEditable = 'true';\n this.textInput.addEventListener(\"paste\", function (event) {\n event.preventDefault();\n if (event.clipboardData) {\n // Normal handling for modern browsers\n const text = event.clipboardData?.getData(\"text/plain\");\n document.execCommand(\"insertHTML\", false, text);\n } else {\n // Fallback logic for IE11\n const globalText = window.clipboardData?.getData(\"Text\");\n const range = document.getSelection()?.getRangeAt(0);\n range?.insertNode(document.createTextNode(globalText));\n }\n });\n } else {\n this.container.classList.add('token-autocomplete-readonly');\n }\n this.container.appendChild(this.textInput);\n\n\n this.container.appendChild(this.hiddenSelect);\n this.addHiddenEmptyOption();\n\n if (this.options.selectMode == SelectModes.MULTI) {\n this.select = new TokenAutocomplete.MultiSelect(this);\n } else if (this.options.selectMode == SelectModes.SEARCH) {\n this.select = new TokenAutocomplete.SearchMultiSelect(this);\n } else if (this.options.selectMode == SelectModes.SINGLE) {\n this.hiddenSelect.removeAttribute('multiple');\n this.select = new TokenAutocomplete.SingleSelect(this);\n }\n this.autocomplete = new TokenAutocomplete.Autocomplete(this);\n\n this.select.initEventListeners();\n this.autocomplete.initEventListeners();\n\n this.debug(false);\n\n if (Array.isArray(this.options.initialTokens)) {\n this.val(this.options.initialTokens);\n }\n\n this.container.tokenAutocomplete = this as TokenAutocomplete;\n\n if (this.options.selectMode == SelectModes.SINGLE && !this.options.optional && this.val().length == 0) {\n this.autocomplete.loadSuggestions();\n }\n }\n\n /**\n * Searches the element given as a container for option elements and creates active tokens (when the option is marked selected)\n * and suggestions (all options found) from these. During this all found options are removed from the DOM.\n */\n parseTokensAndSuggestions() {\n let initialTokens: Array = [];\n let initialSuggestions: Array = [];\n\n let options: NodeListOf = this.container.querySelectorAll('option');\n\n let me = this;\n options.forEach(function (option) {\n if (option.text != null) {\n if (option.hasAttribute('selected')) {\n initialTokens.push({value: option.value, text: option.text, type: null});\n }\n initialSuggestions.push({\n id: null,\n value: option.value,\n fieldLabel: option.text,\n type: null,\n completionDescription: option.dataset.description || null,\n completionLabel: null,\n disabled: option.disabled || false\n });\n }\n me.container.removeChild(option);\n });\n\n if (initialSuggestions.length > 0) {\n this.options.initialSuggestions = initialSuggestions;\n if (!this.options.optional && initialTokens.length == 0) {\n let firstSuggestion = initialSuggestions[0];\n initialTokens.push({\n value: firstSuggestion.value, text: firstSuggestion.fieldLabel, type: firstSuggestion.type\n });\n }\n }\n\n if (initialTokens.length > 0) {\n this.options.initialTokens = initialTokens;\n }\n }\n\n /**\n * Clears the currently present tokens and creates new ones from the given input value, returns new tokens afterwards.\n *\n * The current tokens are only overwritten (cleared and added) when a value parameter is given.\n * In addition to the possibility of setting the value of the input this method also returns the values of all present tokens.\n *\n * @param {(Array|Token)} value - either the name of a single token or a list of tokens to create\n * @param {boolean} silent - whether appropriate events should be triggered when changing tokens or not\n *\n * @returns an array of the values of all current (after update) tokens of the input field\n */\n val(value: Array | Token | null = null, silent: boolean = false): Array {\n if (typeof value !== 'undefined' && value !== null) {\n this.select.clear(silent);\n this.addToken(value, silent);\n }\n\n let tokens: Array = [];\n this.hiddenSelect.querySelectorAll('option').forEach(option => {\n if (option.dataset.value != null && option.dataset.value !== \"\") {\n tokens.push(option.dataset.value);\n }\n });\n return tokens;\n }\n\n\n /**\n * Adds the given tokens to the field.\n *\n * The current tokens are only added when a value parameter is given.\n *\n * @param {(Array|Token)} value - either the name of a single token or a list of tokens to create\n * @param {boolean} silent - whether appropriate events should be triggered when changing tokens or not\n */\n addToken(value: Array | Token, silent: boolean = false) {\n if (Array.isArray(value)) {\n let me = this;\n value.forEach(function (token) {\n if (typeof token === 'object') {\n me.select.addToken(token.value, token.text, token.type, silent);\n }\n });\n } else {\n this.select.addToken(value.value, value.text, value.type, silent);\n }\n }\n\n /**\n * Returns the current text the user has input which is not converted into a token.\n */\n getCurrentInput() {\n return this.textInput.textContent || '';\n }\n\n setCurrentInput(input: string, silent: boolean) {\n this.textInput.textContent = input;\n\n if (silent) {\n return;\n }\n\n this.container.dispatchEvent(new CustomEvent('query-changed', {\n detail: {\n query: input\n }\n }));\n }\n\n addHiddenOption(tokenValue: string, tokenText: string, tokenType: string | null, isLiveEntry: boolean = false) {\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n let _emptyToken = this.hiddenSelect.querySelector('.empty-token');\n if (_emptyToken) {\n this.hiddenSelect.removeChild(_emptyToken);\n }\n let _existingLiveEntry = this.hiddenSelect.querySelector('.live-entry');\n if (_existingLiveEntry) {\n this.hiddenSelect.removeChild(_existingLiveEntry);\n }\n let _existingOption = this.findOptionWithValue(tokenValue);\n if (_existingOption) {\n this.hiddenSelect.removeChild(_existingOption);\n }\n const option = document.createElement('option');\n option.text = tokenText;\n option.value = tokenValue;\n option.selected = true;\n option.dataset.text = tokenText;\n option.dataset.value = tokenValue;\n if (tokenType != null) {\n option.dataset.type = tokenType;\n }\n if (isLiveEntry) {\n option.classList.add('live-entry');\n }\n this.hiddenSelect.add(option);\n }\n\n findOptionWithValue(optionValue: string) {\n for (let i = 0; i < this.hiddenSelect.options.length; i++) {\n let option = this.hiddenSelect.options[i];\n if (option.value === optionValue) {\n return option;\n }\n }\n return null;\n }\n\n addHiddenEmptyOption() {\n let _emptyToken = this.hiddenSelect.querySelector('.empty-token');\n if (_emptyToken) {\n _emptyToken.setAttribute('selected', 'true');\n } else {\n const _newOption = document.createElement('option');\n _newOption.text = '';\n _newOption.value = '';\n _newOption.selected = true;\n _newOption.classList.add('empty-token');\n this.hiddenSelect.add(_newOption);\n }\n }\n\n setPlaceholderText(placeholderText: string | undefined) {\n this.textInput.dataset.placeholder = placeholderText;\n }\n\n debug(state: boolean) {\n if (state) {\n this.log = console.log.bind(window.console);\n } else {\n this.log = function () {\n // Intentionally left empty to only log when debugging is enabled.\n }\n }\n }\n\n static MultiSelect = class implements MultiSelect {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n renderer: TokenRenderer;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n this.renderer = parent.options.tokenRenderer;\n }\n\n clearCurrentInput(): void {\n this.parent.textInput.textContent = '';\n }\n\n initEventListeners(): void {\n const me = this;\n const parent = this.parent;\n if (parent.options.readonly) {\n return;\n }\n\n parent.textInput.addEventListener('compositionend', function (event) {\n // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers\n let inputString = event.data;\n if (inputString.charAt(inputString.length - 1) === \"\\n\") {\n event.preventDefault();\n me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'));\n }\n })\n\n parent.textInput.addEventListener('keydown', function (event) {\n if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) {\n event.preventDefault();\n\n let highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n\n if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) {\n highlightedSuggestion = parent.autocomplete.suggestions.firstChild;\n }\n\n me.handleInput(highlightedSuggestion);\n } else if (parent.getCurrentInput() === '' && event.key == parent.KEY_BACKSPACE) {\n event.preventDefault();\n me.removeLastToken();\n }\n if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) {\n event.preventDefault();\n }\n });\n }\n\n handleInput(highlightedSuggestion: any): void {\n if (highlightedSuggestion !== null) {\n this.clearCurrentInput();\n if (highlightedSuggestion.classList.contains('token-autocomplete-suggestion-active')) {\n this.removeTokenWithText(highlightedSuggestion.dataset.tokenText);\n } else {\n if (highlightedSuggestion.dataset.becomesToken !== 'false') {\n this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false);\n }\n this.parent.autocomplete.dispatchSuggestionSelectedEvent(highlightedSuggestion);\n }\n } else {\n this.handleInputAsValue(this.parent.getCurrentInput());\n }\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n }\n\n /**\n * Adds the current user input as a net token and resets the input area so new text can be entered.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string): void {\n if (input != '' && this.parent.options.allowCustomEntries) {\n this.clearCurrentInput();\n this.addToken(input, input, null);\n return;\n }\n if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') {\n this.parent.autocomplete.suggestions.firstChild.click();\n } else {\n this.clearCurrentInput();\n }\n }\n\n /**\n * Adds a token with the specified name to the list of currently present tokens displayed to the user and the hidden select.\n *\n * @param {string} tokenValue - the actual value of the token to create\n * @param {string} tokenText - the name of the token to create\n * @param {string} tokenType - the type of the token to create\n * @param {boolean} silent - whether an appropriate event should be triggered\n */\n addToken(tokenValue: string | null, tokenText: string | null, tokenType: string | null, silent: boolean = false) {\n if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') {\n return;\n }\n\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n\n this.parent.addHiddenOption(tokenValue, tokenText, tokenType);\n\n let addedToken = {\n value: tokenValue,\n text: tokenText,\n type: tokenType\n };\n\n let element = this.renderer(addedToken);\n\n let me = this;\n element.querySelector('.token-autocomplete-token-delete')?.addEventListener('click', function () {\n me.removeToken(element);\n });\n\n this.container.insertBefore(element, this.parent.textInput);\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n added: addedToken\n }\n }));\n }\n\n this.parent.log('added token', addedToken);\n }\n\n /**\n * Completely clears the currently present tokens from the field.\n */\n clear(silent: boolean = false) {\n let tokens: NodeListOf = this.container.querySelectorAll('.token-autocomplete-token');\n\n let me = this;\n tokens.forEach(function (token) {\n me.removeToken(token, silent);\n });\n }\n\n /**\n * Removes the last token in the list of currently present token. This is the last added token next to the input field.\n */\n removeLastToken() {\n let tokens = this.container.querySelectorAll('.token-autocomplete-token');\n let token = tokens[tokens.length - 1];\n if (token) {\n this.removeToken(token);\n }\n }\n\n /**\n * Removes the specified token from the list of currently present tokens.\n *\n * @param {Element} token - the token to remove\n * @param {boolean} silent - whether an appropriate event should be triggered\n */\n removeToken(token: HTMLElement, silent: boolean = false) {\n this.container.removeChild(token);\n\n let tokenText = token.dataset.text;\n let hiddenOption = this.parent.hiddenSelect.querySelector('option[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]');\n hiddenOption?.parentElement?.removeChild(hiddenOption);\n\n let addedToken = {\n value: token.dataset.value,\n text: tokenText,\n type: token.dataset.type || null\n };\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n removed: addedToken\n }\n }));\n }\n\n if (this.parent.val().length === 0) {\n this.parent.addHiddenEmptyOption();\n }\n\n this.parent.log('removed token', token.textContent);\n }\n\n removeTokenWithText(tokenText: string | null) {\n if (tokenText === null) {\n return;\n }\n let token = this.container.querySelector('.token-autocomplete-token[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]');\n if (token !== null) {\n this.removeToken(token);\n }\n }\n\n static defaultRenderer: TokenRenderer = function (token: Token): HTMLElement {\n const chip = document.createElement('span');\n chip.classList.add('token-autocomplete-token');\n chip.dataset.text = token.text;\n chip.dataset.value = token.value;\n if (token.type != null) {\n chip.dataset.type = token.type;\n }\n chip.textContent = token.text;\n\n let deleteToken = document.createElement('span');\n deleteToken.classList.add('token-autocomplete-token-delete');\n deleteToken.textContent = '\\u00D7';\n chip.appendChild(deleteToken);\n\n return chip;\n }\n\n static defaultReadonlyRenderer: TokenRenderer = function (token: Token): HTMLElement {\n const chip = document.createElement('span');\n chip.classList.add('token-autocomplete-token');\n chip.dataset.text = token.text;\n chip.dataset.value = token.value;\n if (token.type != null) {\n chip.dataset.type = token.type;\n }\n chip.textContent = token.text;\n\n return chip;\n }\n }\n\n static SingleSelect = class implements SingleSelect {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n renderer: TokenRenderer;\n previousValue: any;\n previousText: any;\n previousType: any;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n\n this.container.classList.add('token-autocomplete-singleselect');\n this.parent.textInput.tabIndex = 0;\n if (this.options.optional) {\n let deleteToken = document.createElement('span');\n deleteToken.classList.add('token-singleselect-token-delete');\n deleteToken.textContent = '\\u00D7';\n this.container.appendChild(deleteToken);\n }\n }\n\n /**\n * Clears the current user input so new text can be entered.\n *\n * @param {boolean} silent - whether an appropriate event should be triggered\n * @param {boolean} keepPreviousValue - if true, the previous value will be stored and shown as a placeholder\n */\n clear(silent: boolean, keepPreviousValue = true): void {\n if (this.options.readonly) {\n return;\n }\n let me = this;\n let tokenText = me.parent.textInput.textContent;\n let hiddenOption = me.parent.hiddenSelect.querySelector('option[data-text=\"' + TokenAutocomplete.escapeQuotes(tokenText) + '\"]') as HTMLElement;\n if (me.options.optional) {\n this.container.classList.remove('optional-singleselect-with-value');\n }\n if (keepPreviousValue) {\n me.previousValue = hiddenOption?.dataset.value;\n me.previousText = hiddenOption?.dataset.text;\n me.previousType = hiddenOption?.dataset.type;\n if (hiddenOption == null && me.options.allowCustomEntries) {\n me.previousValue = tokenText;\n me.previousText = tokenText;\n }\n if (me.previousText && me.previousText !== '') {\n me.parent.textInput.dataset.placeholder = me.previousText;\n }\n } else {\n // We should reset these fields, so they are not used to restore the previously selected value\n // when the focusout event is handled after the click event on the suggestion.\n delete me.previousValue;\n delete me.previousText;\n delete me.previousType;\n if (me.parent.options.placeholderText != null) {\n me.parent.textInput.dataset.placeholder = me.parent.options.placeholderText;\n }\n }\n hiddenOption?.parentElement?.removeChild(hiddenOption);\n me.parent.addHiddenEmptyOption();\n me.parent.textInput.textContent = '';\n me.parent.textInput.contentEditable = 'true';\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n }\n }));\n }\n }\n\n /**\n * Adds the current user input as a net token and resets the input area so new text can be entered.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string): void {\n if (input != '' && this.parent.options.allowCustomEntries) {\n this.clearCurrentInput();\n this.addToken(input, input, null, false);\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n return;\n }\n if (this.parent.autocomplete.suggestions.childNodes.length === 1 && this.parent.autocomplete.suggestions.childNodes[0].dataset.value != '_no_match_') {\n this.parent.autocomplete.suggestions.firstChild.click();\n return;\n }\n this.clear(true, false);\n }\n\n clearCurrentInput(): void {\n this.clear(true);\n }\n\n addToken(tokenValue: string | null, tokenText: string | null, tokenType: string | null, silent: boolean): void {\n if (tokenValue === null || tokenText === null || tokenValue === '_no_match_') {\n return;\n }\n\n tokenValue = tokenValue.trim();\n tokenText = tokenText.trim();\n\n this.clear(true, false);\n this.parent.textInput.textContent = tokenText;\n this.parent.textInput.contentEditable = 'false';\n this.parent.textInput.blur();\n if (this.options.optional && tokenText !== '') {\n this.container.classList.add('optional-singleselect-with-value');\n }\n\n this.parent.addHiddenOption(tokenValue, tokenText, tokenType);\n\n if (!silent) {\n this.container.dispatchEvent(new CustomEvent('tokens-changed', {\n detail: {\n tokens: this.parent.val(),\n added: {\n value: tokenValue,\n text: tokenText,\n type: tokenType\n }\n }\n }));\n }\n }\n\n initEventListeners(): void {\n const me = this;\n const parent = this.parent;\n if (parent.options.readonly) {\n return;\n }\n\n parent.textInput.addEventListener('compositionend', function (event) {\n // handles hitting ENTER on GBoard, which uses composition events instead of individual key triggers\n let inputString = event.data;\n if (inputString.charAt(inputString.length - 1) === \"\\n\") {\n event.preventDefault();\n me.handleInput(parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted'));\n }\n })\n\n parent.textInput.addEventListener('keydown', function (event) {\n if (event.key == parent.KEY_ENTER || (event.key == parent.KEY_TAB && parent.options.enableTabulator)) {\n event.preventDefault();\n\n let highlightedSuggestion = parent.autocomplete.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n\n if (parent.options.enableTabulator && highlightedSuggestion == null && event.key == parent.KEY_TAB && parent.autocomplete.areSuggestionsDisplayed()) {\n highlightedSuggestion = parent.autocomplete.suggestions.firstChild;\n }\n\n me.handleInput(highlightedSuggestion);\n }\n if ((event.key == parent.KEY_DOWN || event.key == parent.KEY_UP) && parent.autocomplete.suggestions.childNodes.length > 0) {\n event.preventDefault();\n }\n });\n\n if (parent.options.allowCustomEntries) {\n parent.textInput.addEventListener('keyup', function (event) {\n if (event.key != parent.KEY_ENTER && event.key != parent.KEY_TAB && event.key != parent.KEY_DOWN && event.key != parent.KEY_UP) {\n event.preventDefault();\n parent.addHiddenOption(parent.getCurrentInput(), parent.getCurrentInput(), null, true);\n }\n });\n }\n\n function focusInput() {\n if (!parent.autocomplete.areSuggestionsDisplayed() && parent.options.showSuggestionsOnFocus) {\n parent.autocomplete.showSuggestions();\n parent.autocomplete.loadSuggestions();\n }\n // move the cursor into the editable div\n const selection = window.getSelection();\n const range = document.createRange();\n selection?.removeAllRanges();\n range.selectNodeContents(parent.textInput);\n range.collapse(false);\n selection?.addRange(range);\n parent.textInput.focus();\n }\n\n parent.textInput.addEventListener('click', function () {\n focusInput();\n });\n\n parent.textInput.addEventListener('focusout', function () {\n // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling.\n // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input.\n // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected.\n // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example)\n setTimeout(function () {\n if (parent.autocomplete.areSuggestionsActive()) {\n return;\n }\n const input = me.parent.getCurrentInput();\n if (me.parent.val().length !== 0 && me.parent.val()[0] !== '') {\n return;\n }\n if (input != '') {\n me.handleInputAsValue(input);\n return;\n }\n if (me.previousValue) {\n me.addToken(me.previousValue, me.previousText, me.previousType, true);\n }\n }, 0);\n\n });\n parent.container.querySelector('.token-singleselect-token-delete')?.addEventListener('click', function () {\n me.clear(false, false);\n });\n }\n\n handleInput(highlightedSuggestion: any): void {\n if (highlightedSuggestion !== null) {\n this.addToken(highlightedSuggestion.dataset.value, highlightedSuggestion.dataset.tokenText, highlightedSuggestion.dataset.type, false);\n } else {\n this.handleInputAsValue(this.parent.getCurrentInput());\n }\n this.parent.autocomplete.clearSuggestions();\n this.parent.autocomplete.hideSuggestions();\n }\n }\n\n static SearchMultiSelect = class extends TokenAutocomplete.MultiSelect {\n /**\n * Instead of adding the custom user input as a token and handling it as a filter we let it remain in the input\n * area and instead send an event so the user search request can be handled / executed.\n *\n * @param {string} input - the actual input the user entered\n */\n handleInputAsValue(input: string) {\n this.container.dispatchEvent(new CustomEvent('query-changed', {\n detail: {\n query: input\n }\n }));\n }\n }\n\n static Autocomplete = class implements Autocomplete {\n\n parent: TokenAutocomplete;\n container: any;\n options: Options;\n suggestions: HTMLUListElement;\n renderer: SuggestionRenderer;\n request: XMLHttpRequest | null;\n timeout: number | undefined;\n\n constructor(parent: TokenAutocomplete) {\n this.parent = parent;\n this.container = parent.container;\n this.options = parent.options;\n this.renderer = parent.options.suggestionRenderer;\n\n this.suggestions = document.createElement('ul');\n this.suggestions.id = this.container.id + '-suggestions';\n this.suggestions.classList.add('token-autocomplete-suggestions');\n\n this.container.appendChild(this.suggestions);\n }\n\n initEventListeners() {\n let me = this;\n if (me.parent.options.readonly) {\n return;\n }\n me.parent.textInput.addEventListener('keyup', function (event) {\n if (event.key == me.parent.KEY_ESC) {\n me.hideSuggestions();\n me.parent.textInput.blur();\n return;\n }\n if (event.key == me.parent.KEY_UP && me.suggestions.childNodes.length > 0) {\n event.preventDefault();\n let highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n if (highlightedSuggestion == null) {\n // highlight last entry and scroll to bottom\n me.highlightSuggestionAtPosition(me.suggestions.childNodes.length - 1);\n me.suggestions.scrollTop = me.suggestions.scrollHeight;\n return;\n }\n let aboveSuggestion = highlightedSuggestion.previousSibling;\n if (aboveSuggestion != null) {\n // if the suggestions is above the scroll position, scroll to the suggestion\n let suggestionTop = (aboveSuggestion as HTMLElement).offsetTop;\n if (me.suggestions.scrollTop > suggestionTop) {\n me.suggestions.scrollTop = suggestionTop;\n }\n me.highlightSuggestion(aboveSuggestion as Element);\n } else {\n highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n }\n return;\n }\n if (event.key == me.parent.KEY_DOWN && me.suggestions.childNodes.length > 0) {\n event.preventDefault();\n let highlightedSuggestion = me.suggestions.querySelector('.token-autocomplete-suggestion-highlighted');\n if (highlightedSuggestion == null) {\n // highlight first entry and scroll to top\n me.highlightSuggestionAtPosition(0);\n me.suggestions.scrollTop = 0;\n return;\n }\n let belowSuggestion = highlightedSuggestion?.nextSibling;\n if (belowSuggestion != null) {\n // if the suggestions is not completely visible, scroll until the suggestion is at the bottom\n let suggestionBottom = (belowSuggestion as HTMLElement).offsetTop + (belowSuggestion as HTMLElement).offsetHeight;\n if (me.suggestions.scrollTop + me.suggestions.clientHeight < suggestionBottom) {\n me.suggestions.scrollTop = suggestionBottom - me.suggestions.clientHeight;\n }\n me.highlightSuggestion(belowSuggestion as Element);\n } else {\n highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n }\n return;\n }\n if (event.key == me.parent.KEY_LEFT || event.key == me.parent.KEY_RIGHT || event.key == me.parent.KEY_ENTER || event.key == me.parent.KEY_TAB) {\n // We don't want to re-trigger the autocompletion when the user navigates the cursor inside the input.\n return;\n }\n me.loadSuggestions();\n });\n me.parent.textInput.addEventListener('focusout', function () {\n // Using setTimeout here seems hacky on first sight but ensures proper order of events / handling.\n // We first want to handle a click on a suggestion (when one is made) before hiding the suggestions on focusout of the input.\n // Not doing so could mean the suggestion is hidden before the click is handled und thus resulting in not being selected.\n // This depends on the order in which a browser handles different events and when it sets the active pseudo-selector on clicked events (Firefox for example)\n setTimeout(function () {\n if (me.areSuggestionsActive()) {\n return;\n }\n me.hideSuggestions();\n }, 0);\n });\n me.parent.textInput.addEventListener('focusin', function () {\n if (me.options.showSuggestionsOnFocus) {\n me.loadSuggestions();\n me.showSuggestions();\n }\n });\n }\n\n loadSuggestions() {\n let me = this;\n let value = me.parent.getCurrentInput();\n\n if (me.parent.options.selectMode == SelectModes.SINGLE) {\n if (!me.parent.textInput.isContentEditable) {\n me.parent.select.clear(true);\n value = \"\";\n }\n } else if (value.length < me.parent.options.minCharactersForSuggestion) {\n me.clearSuggestions();\n me.hideSuggestions();\n return;\n }\n if (me.parent.options.suggestionsUri.length > 0) {\n me.requestSuggestions(value);\n return;\n }\n if (Array.isArray(me.parent.options.initialSuggestions)) {\n me.clearSuggestions();\n me.parent.options.initialSuggestions.forEach(function (suggestion) {\n if (typeof suggestion !== 'object') {\n // The suggestion is of wrong type and therefore ignored.\n return;\n }\n let text = suggestion.fieldLabel;\n if (value.length == 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) {\n me.addSuggestion(suggestion, false);\n } else if (value.localeCompare(text.slice(0, value.length), undefined, {sensitivity: 'base'}) === 0) {\n // The suggestion starts with the query text the user entered and will be displayed.\n me.addSuggestion(suggestion);\n }\n });\n if (me.suggestions.childNodes.length == 0) {\n if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) {\n me.addSuggestion({\n id: null,\n value: value,\n fieldLabel: value,\n type: '_no_match_',\n completionDescription: me.parent.options.noMatchesCustomEntriesDescription,\n completionLabel: null,\n disabled: true\n });\n\n } else if (me.parent.options.noMatchesText) {\n me.addSuggestion({\n id: null,\n value: '_no_match_',\n fieldLabel: me.parent.options.noMatchesText,\n type: '_no_match_',\n completionDescription: null,\n completionLabel: null,\n disabled: true\n });\n }\n }\n }\n }\n\n /**\n * Hides the suggestions dropdown from the user.\n */\n hideSuggestions() {\n // as the suggestions will be re-shown if a pending request is executed, we abort them if we want to hide\n this.abortPendingRequest();\n this.suggestions.style.display = '';\n\n let _highlightedSuggestions = this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted');\n _highlightedSuggestions.forEach(function (_suggestion) {\n _suggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n }\n\n /**\n * Shows the suggestions dropdown to the user.\n */\n showSuggestions() {\n this.suggestions.style.display = 'block';\n }\n\n areSuggestionsDisplayed() {\n return this.suggestions.style.display === 'block';\n }\n\n highlightSuggestionAtPosition(index: number) {\n let _suggestions = this.suggestions.querySelectorAll('li');\n _suggestions.forEach(function (_suggestion) {\n _suggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n _suggestions[index].classList.add('token-autocomplete-suggestion-highlighted');\n }\n\n highlightSuggestion(_suggestion: Element) {\n this.suggestions.querySelectorAll('li.token-autocomplete-suggestion-highlighted').forEach(function (_highlightedSuggestion) {\n _highlightedSuggestion.classList.remove('token-autocomplete-suggestion-highlighted');\n })\n _suggestion.classList.add('token-autocomplete-suggestion-highlighted');\n }\n\n /**\n * Checks for the presence of a suggestion that is currently clicked via mouse (active).\n */\n areSuggestionsActive() {\n return !!this.suggestions.querySelector('li:active');\n }\n\n /**\n * Removes all previous suggestions from the dropdown.\n */\n clearSuggestions() {\n this.abortPendingRequest();\n this.suggestions.innerHTML = '';\n }\n\n /**\n * Aborts currently in progress or scheduled suggestions requests.\n */\n abortPendingRequest() {\n this.request?.abort();\n clearTimeout(this.timeout);\n }\n\n /**\n * Loads suggestions matching the given query from the rest service behind the URI given as an option while initializing the field.\n *\n * @param query the query to search suggestions for\n */\n requestSuggestions(query: string) {\n let me = this;\n clearTimeout(me.timeout);\n if (!me.timeout) {\n me.debouncedRequestSuggestions.call(me, query);\n me.timeout = window.setTimeout(function () {\n delete me.timeout;\n }, me.parent.options.requestDelay);\n } else {\n me.timeout = window.setTimeout(function () {\n delete me.timeout;\n me.debouncedRequestSuggestions.call(me, query);\n }, me.parent.options.requestDelay);\n }\n }\n\n dispatchSuggestionSelectedEvent(_suggestion: HTMLElement) {\n _suggestion.dispatchEvent(new CustomEvent('suggestion-selected', {\n detail: {\n value: _suggestion.dataset.value,\n text: _suggestion.dataset.text,\n type: _suggestion.dataset.type || null\n }\n }));\n }\n\n debouncedRequestSuggestions(query: string) {\n let me = this;\n\n if (me.request != null && me.request.readyState) {\n me.request.abort();\n }\n\n me.request = new XMLHttpRequest();\n me.request.onload = function () {\n me.request = null;\n\n me.clearSuggestions();\n\n let answer = this.response;\n // IE 11 doesn't properly respect content type header, need to parse json string by hand.\n if (typeof answer === 'string') {\n answer = JSON.parse(answer);\n }\n\n if (Array.isArray(answer.completions)) {\n if (me.parent.val().length == 0 && answer.completions.length > 0 && me.options.selectMode == SelectModes.SINGLE && !me.options.optional && !me.areSuggestionsDisplayed()) {\n answer.completions.forEach(function (suggestion: Suggestion) {\n me.addSuggestion(suggestion, false);\n });\n let firstSuggestion = answer.completions[0] as Suggestion;\n let value = firstSuggestion.id || firstSuggestion.value;\n me.parent.select.addToken(value, firstSuggestion.fieldLabel, firstSuggestion.type, true);\n return;\n }\n answer.completions.forEach(function (suggestion: Suggestion) {\n me.addSuggestion(suggestion);\n });\n if (me.suggestions.childNodes.length == 0) {\n if (me.parent.options.allowCustomEntries && me.parent.options.noMatchesCustomEntriesDescription) {\n me.addSuggestion({\n id: null,\n value: query,\n fieldLabel: query,\n type: '_no_match_',\n completionDescription: me.parent.options.noMatchesCustomEntriesDescription,\n completionLabel: null,\n disabled: true\n });\n\n } else if (me.parent.options.noMatchesText) {\n me.addSuggestion({\n id: null,\n value: '_no_match_',\n fieldLabel: me.parent.options.noMatchesText,\n type: '_no_match_',\n completionDescription: null,\n completionLabel: null,\n disabled: true\n });\n }\n }\n }\n };\n let suggestionsUri = me.options.suggestionsUriBuilder(query);\n me.request.open('GET', suggestionsUri, true);\n me.request.responseType = 'json';\n me.request.setRequestHeader('Content-type', 'application/json');\n me.request.send();\n }\n\n /**\n * Adds a suggestion with the given text matching the users input to the dropdown.\n *\n * @param {string} suggestion - the metadata of the suggestion that should be added\n * @param showSuggestions - if the suggestions box should be shown, default true\n */\n addSuggestion(suggestion: Suggestion, showSuggestions = true) {\n let element = this.renderer(suggestion);\n\n let value = suggestion.id || suggestion.value;\n let text = suggestion.completionLabel || suggestion.fieldLabel;\n\n element.dataset.value = value;\n element.dataset.text = text;\n element.dataset.tokenText = suggestion.fieldLabel;\n if (suggestion.type != null) {\n element.dataset.type = suggestion.type;\n }\n\n let me = this;\n element.addEventListener('click', function (_event: Event) {\n if (value == '_no_match_' || suggestion.disabled) {\n return;\n }\n if (me.parent.options.selectMode == SelectModes.SINGLE) {\n if (element.classList.contains('token-autocomplete-suggestion-active')) {\n me.parent.select.clear(false);\n } else {\n if (element.dataset.becomesToken !== 'false') {\n me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false);\n }\n me.dispatchSuggestionSelectedEvent(element);\n }\n } else {\n me.parent.select.clearCurrentInput();\n if (element.classList.contains('token-autocomplete-suggestion-active')) {\n let multiSelect = me.parent.select as MultiSelect;\n multiSelect.removeTokenWithText(suggestion.fieldLabel);\n } else {\n if (element.dataset.becomesToken !== 'false') {\n me.parent.select.addToken(value, suggestion.fieldLabel, suggestion.type, false);\n }\n me.dispatchSuggestionSelectedEvent(element);\n }\n }\n me.clearSuggestions();\n me.hideSuggestions();\n });\n\n if (suggestion.disabled) {\n element.classList.add('token-autocomplete-suggestion-disabled');\n }\n\n if (this.container.querySelector('.token-autocomplete-token[data-value=\"' + value + '\"]') !== null) {\n element.classList.add('token-autocomplete-suggestion-active');\n }\n\n this.suggestions.appendChild(element);\n if (showSuggestions) {\n this.showSuggestions();\n }\n\n me.parent.log('added suggestion', suggestion);\n }\n\n static defaultRenderer: SuggestionRenderer = function (suggestion: Suggestion): HTMLElement {\n let option = document.createElement('li');\n option.textContent = suggestion.completionLabel || suggestion.fieldLabel;\n\n if (suggestion.completionDescription) {\n let description = document.createElement('small');\n description.textContent = suggestion.completionDescription;\n description.classList.add('token-autocomplete-suggestion-description');\n option.appendChild(description);\n }\n\n return option;\n }\n }\n\n static escapeQuotes(text: string | null | undefined): string {\n return text?.replace(/\\x22/g, '\\\\\\x22') ?? '';\n }\n}\n"]} \ No newline at end of file