This commit is contained in:
2026-02-18 03:13:44 +02:00
parent 1bffdd1d6a
commit 3092a96a68
2 changed files with 12 additions and 44 deletions
+1 -1
View File
@@ -552,7 +552,7 @@
/**
* Get Widget Data Value
*/
nval() {
key() {
return this[ Ut.WidgetUID ]?.getValue();
},
+11 -43
View File
@@ -7,9 +7,6 @@ import { Cancelable } from '../cancelable'
export class Autocomplete {
/**
* Autocomplete, Constructor
*/
constructor(target, data, opts) {
this.target = target;
@@ -43,15 +40,12 @@ export class Autocomplete {
}
new Cancelable(this.target);
this.renderContainer();
this.setEvents();
}
/**
* Autocomplete, Render Container
*/
renderContainer() {
this.ui = {
@@ -61,9 +55,6 @@ export class Autocomplete {
this.ui.wrapper.style.maxHeight = (this.opts.maxOptions * this.opts.optionHeight) + 'px';
}
/**
* Autocomplete, Set Events
*/
setEvents() {
// Input Event Handler
@@ -79,15 +70,12 @@ export class Autocomplete {
this.ui.wrapper.dxOn('click', '.ac-option', (e, t) => this.clickOptionHandler(e, t));
// Click outside
document.body.dxOn('click.autocomplete', e => e.target != this.target && this.clear());
document.body.dxOn('click.autocomplete', e => e.target != this.target && this.release());
}
/**
* Autocomplete, processData
*/
processData(val) {
this.clear();
this.release();
let found = true;
let matchId = '';
@@ -143,9 +131,6 @@ export class Autocomplete {
}
}
/**
* Autocomplete, Input Handler
*/
inputHandler(_, t) {
//e.stopPropagation();
@@ -172,9 +157,6 @@ export class Autocomplete {
}
}
/**
* Autocomplete, Keydown Event Handler
*/
keydownHandler(e, t) {
if (!this.count) {
@@ -220,21 +202,15 @@ export class Autocomplete {
}
}
/**
* Autocomplete, Click Option Handler
*/
clickOptionHandler(e, t) {
e.stopPropagation();
this.restoreValue(t.dataset.id);
}
/**
* Autocomplete, Update Val
*/
restoreValue(id) {
if (id == this.value) {
this.clear();
this.release();
return;
}
@@ -245,16 +221,13 @@ export class Autocomplete {
Ut.trigger(this.opts.onChange, this);
this.target.dxTrigger('changed');
this.clear();
this.release();
}
getValue() {
return this.value;
}
/**
* Autocomplete, Set Active Option
*/
setActiveOption() {
this.selected = this.ui.wrapper.children[this.index];
@@ -278,20 +251,18 @@ export class Autocomplete {
}
}
/**
* Autocomplete Update Options
*/
updateOptions(data) {
this.clear();
this.data = data;
}
/**
* Autocomplete Clear Options
*/
clear() {
this.value = '';
this.release();
}
release() {
this.selected = null;
this.count = 0;
this.index = -1;
@@ -302,9 +273,6 @@ export class Autocomplete {
this.ui.wrapper.dxHtml('');
}
/**
* Autocomplete, Destroy
*/
destroy() {
this.ui.wrapper.remove();