diff --git a/src/Autocomplete/assets/dist/controller.js b/src/Autocomplete/assets/dist/controller.js index e021770d8b5..6ad559fb55e 100644 --- a/src/Autocomplete/assets/dist/controller.js +++ b/src/Autocomplete/assets/dist/controller.js @@ -235,6 +235,11 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def if (this.urlValue) { plugins.virtual_scroll = {}; } + if ('plugins' in this.tomSelectOptionsValue && Array.isArray(this.tomSelectOptionsValue.plugins)) { + this.tomSelectOptionsValue.plugins.forEach((pluginName) => { + plugins[pluginName] = {}; + }); + } const render = { no_results: () => { return `
${this.noResultsFoundTextValue}
`; @@ -288,7 +293,7 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def if (!this.selectElement && !this.urlValue) { config.shouldLoad = () => false; } - return __classPrivateFieldGet(this, _default_1_instances, "m", _default_1_mergeObjects).call(this, config, this.tomSelectOptionsValue); + return __classPrivateFieldGet(this, _default_1_instances, "m", _default_1_mergeObjects).call(this, this.tomSelectOptionsValue, config); }, _default_1_createAutocomplete = function _default_1_createAutocomplete() { const config = __classPrivateFieldGet(this, _default_1_instances, "m", _default_1_mergeObjects).call(this, __classPrivateFieldGet(this, _default_1_instances, "m", _default_1_getCommonConfig).call(this), { maxOptions: this.getMaxOptions(), diff --git a/src/Autocomplete/assets/src/controller.ts b/src/Autocomplete/assets/src/controller.ts index 6b68283b51d..c6a05a28eb2 100644 --- a/src/Autocomplete/assets/src/controller.ts +++ b/src/Autocomplete/assets/src/controller.ts @@ -149,6 +149,12 @@ export default class extends Controller { plugins.virtual_scroll = {}; } + if ('plugins' in this.tomSelectOptionsValue && Array.isArray(this.tomSelectOptionsValue.plugins)) { + this.tomSelectOptionsValue.plugins.forEach((pluginName) => { + plugins[pluginName] = {}; + }); + } + const render: Partial = { no_results: () => { return `
${this.noResultsFoundTextValue}
`; @@ -214,7 +220,7 @@ export default class extends Controller { config.shouldLoad = () => false; } - return this.#mergeObjects(config, this.tomSelectOptionsValue); + return this.#mergeObjects(this.tomSelectOptionsValue, config); } #createAutocomplete(): TomSelect {