jsdialog: add edit field for combobox

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I5a1ab436c34a8406c6de4b08b3e55ee11a106d43
This commit is contained in:
Szymon Kłos 2023-08-22 09:29:04 +02:00 committed by Szymon Kłos
parent 9a6964ce7e
commit e90ab292b6

View file

@ -75,15 +75,19 @@ JSDialog.combobox = function (parentContainer, data, builder) {
var container = L.DomUtil.create('div', 'ui-combobox ' + builder.options.cssClass, parentContainer); var container = L.DomUtil.create('div', 'ui-combobox ' + builder.options.cssClass, parentContainer);
container.id = data.id; container.id = data.id;
var content = L.DomUtil.create('div', 'ui-combobox-content ' + builder.options.cssClass, container); var content = L.DomUtil.create('input', 'ui-combobox-content ' + builder.options.cssClass, container);
content.innerText = data.text; content.value = data.text;
var button = L.DomUtil.create('div', 'ui-combobox-button ' + builder.options.cssClass, container); var button = L.DomUtil.create('div', 'ui-combobox-button ' + builder.options.cssClass, container);
var arrow = L.DomUtil.create('span', builder.options.cssClass + ' ui-listbox-arrow', button); var arrow = L.DomUtil.create('span', builder.options.cssClass + ' ui-listbox-arrow', button);
arrow.id = 'listbox-arrow-' + data.id; arrow.id = 'listbox-arrow-' + data.id;
content.addEventListener('keyup', function () {
builder.callback('combobox', 'change', data, this.value, builder);
});
var dropdownEntriesId = data.id + '-entries'; var dropdownEntriesId = data.id + '-entries';
content.addEventListener('click', function () { button.addEventListener('click', function () {
var dropdownWindowId = data.id + '-dropdown'; var dropdownWindowId = data.id + '-dropdown';
var json = { var json = {
id: dropdownWindowId, // fake WindowId, rewritten in callback id: dropdownWindowId, // fake WindowId, rewritten in callback