tom select udpated to 2.4.6. fixes #644

This commit is contained in:
mic 2026-02-08 21:14:07 +01:00
parent e7995952df
commit bf29673600
3 changed files with 24 additions and 14 deletions

View file

@ -2,7 +2,7 @@ file: pages\_lib\list.js
source: https://raw.githubusercontent.com/javve/list.js/v2.3.1/dist/list.js
file: pages\_lib\tom-select.base.js
source: https://cdn.jsdelivr.net/npm/tom-select@2.4.4/dist/js/tom-select.base.js
source: https://cdn.jsdelivr.net/npm/tom-select@2.4.6/dist/js/tom-select.base.js
file: js\lib\diff.js
source: https://cdnjs.cloudflare.com/ajax/libs/jsdiff/7.0.0/diff.js

View file

@ -1,5 +1,5 @@
/**
* Tom Select v2.4.4
* Tom Select v2.4.6
* Licensed under the Apache License, Version 2.0 (the "License");
*/
@ -1889,6 +1889,8 @@
});
}
wrapper.style.width = input.style.width;
wrapper.style.minWidth = input.style.minWidth;
wrapper.style.maxWidth = input.style.maxWidth;
if (self.plugins.names.length) {
const classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
addClasses([wrapper, dropdown], classes_plugins);
@ -1985,10 +1987,19 @@
self.positionDropdown();
}
};
const input_invalid = () => {
if (self.isValid) {
self.isValid = false;
self.isInvalid = true;
self.refreshState();
}
};
addEvent(input, 'invalid', input_invalid);
addEvent(document, 'mousedown', doc_mousedown);
addEvent(window, 'scroll', win_scroll, passive_event);
addEvent(window, 'resize', win_scroll, passive_event);
this._destroy = () => {
input.removeEventListener('invalid', input_invalid);
document.removeEventListener('mousedown', doc_mousedown);
window.removeEventListener('scroll', win_scroll);
window.removeEventListener('resize', win_scroll);
@ -2007,13 +2018,6 @@
settings.items = [];
delete settings.optgroups;
delete settings.options;
addEvent(input, 'invalid', () => {
if (self.isValid) {
self.isValid = false;
self.isInvalid = true;
self.refreshState();
}
});
self.refreshItems();
self.close(false);
self.inputState();
@ -2128,7 +2132,8 @@
sync(get_settings = true) {
const self = this;
const settings = get_settings ? getSettings(self.input, {
delimiter: self.settings.delimiter
delimiter: self.settings.delimiter,
allowEmptyOption: self.settings.allowEmptyOption
}) : self.settings;
self.setupOptions(settings.options, settings.optgroups);
self.setValue(settings.items || [], true); // silent prevents recursion
@ -2315,8 +2320,7 @@
// prevent default [tab] behaviour of jump to the next field
// if select isFull, then the dropdown won't be open and [tab] will work normally
preventDefault(e);
}
if (self.settings.create && self.createItem()) {
} else if (self.settings.create && self.createItem()) {
preventDefault(e);
}
}
@ -3512,6 +3516,12 @@
var output;
input = input || self.inputValue();
if (!self.canCreate(input)) {
const hash = hash_key(input);
if (hash) {
if (this.options[input]) {
self.addItem(input);
}
}
callback();
return false;
}
@ -3831,7 +3841,7 @@
const values = items.map(item => item.dataset.value);
// allow the callback to abort
if (!values.length || typeof this.settings.onDelete === 'function' && this.settings.onDelete(values, evt) === false) {
if (!values.length || typeof this.settings.onDelete === 'function' && this.settings.onDelete.call(this, values, evt) === false) {
return false;
}
return true;

File diff suppressed because one or more lines are too long