Skip to content

Commit c811f02

Browse files
maartendekeizerKocal
authored andcommitted
Autocomplete: Don't add plugins automaticly when defined #379
1 parent 45f31cc commit c811f02

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/Autocomplete/assets/src/controller.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,21 @@ export default class extends Controller {
135135
#getCommonConfig(): Partial<TomSettings> {
136136
const plugins: TPluginHash = {};
137137

138-
// multiple values excepted if this is NOT A select (i.e. input) or a multiple select
139-
const isMultiple = !this.selectElement || this.selectElement.multiple;
140-
if (!this.formElement.disabled && !isMultiple) {
141-
plugins.clear_button = { title: '' };
142-
}
138+
// automaticly add plugins when NOT explicit configured
139+
if (!this.tomSelectOptionsValue || !this.tomSelectOptionsValue.plugins !== undefined) {
140+
// multiple values excepted if this is NOT A select (i.e. input) or a multiple select
141+
const isMultiple = !this.selectElement || this.selectElement.multiple;
142+
if (!this.formElement.disabled && !isMultiple) {
143+
plugins.clear_button = { title: '' };
144+
}
143145

144-
if (isMultiple) {
145-
plugins.remove_button = { title: '' };
146-
}
146+
if (isMultiple) {
147+
plugins.remove_button = { title: '' };
148+
}
147149

148-
if (this.urlValue) {
149-
plugins.virtual_scroll = {};
150+
if (this.urlValue) {
151+
plugins.virtual_scroll = {};
152+
}
150153
}
151154

152155
const render: Partial<TomTemplates> = {

0 commit comments

Comments
 (0)