fix panel dropping issue about input drop-down box
This commit is contained in:
parent
671a075c48
commit
067d6252b2
@ -89,11 +89,19 @@
|
||||
<script type="text/javascript">
|
||||
!function () {
|
||||
const Dropdown = window["lib-ui"].Dropdown;
|
||||
console.log(Dropdown);
|
||||
const sample = document.querySelector('#dropdown-sample');
|
||||
|
||||
Dropdown.resolve(document.querySelector('#dropdown-sample'));
|
||||
Dropdown.resolve(sample);
|
||||
|
||||
const drop = new Dropdown({
|
||||
let drop = new Dropdown({
|
||||
input: true,
|
||||
selected: 'standby'
|
||||
});
|
||||
drop.source = ['off', 'running', 'standby', 'broken']
|
||||
.map(it => { return { value: it, text: it } });
|
||||
sample.appendChild(drop.create());
|
||||
|
||||
drop = new Dropdown({
|
||||
selected: '#ff0',
|
||||
search: true,
|
||||
multiselect: true
|
||||
@ -114,7 +122,7 @@
|
||||
span.innerText = it.text;
|
||||
it.html = span;
|
||||
});
|
||||
document.querySelector("#dropdown-sample").appendChild(drop.create());
|
||||
sample.appendChild(drop.create());
|
||||
}();
|
||||
</script>
|
||||
<style type="text/css">
|
||||
@ -122,7 +130,7 @@
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#dropdown-sample > .dropdown-wrapper {
|
||||
#dropdown-sample>.dropdown-wrapper {
|
||||
width: 200px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
@ -363,18 +363,14 @@ class Dropdown {
|
||||
// const event = new InputEvent('type');
|
||||
// inputSearch.dispatchEvent(event);
|
||||
// }
|
||||
if (options.input) {
|
||||
this.#label.dispatchEvent(new InputEvent('type'));
|
||||
} else if (options.search) {
|
||||
if (!options.input && options.search) {
|
||||
const search = panel.querySelector('.dropdown-search > input');
|
||||
if (!nullOrEmpty(search?.value)) {
|
||||
search.dispatchEvent(new InputEvent('type'));
|
||||
} else {
|
||||
this.#filllist(this.source);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.#filllist(this.source);
|
||||
}
|
||||
this.#filllist(this.source);
|
||||
} else {
|
||||
panel.classList.remove('active');
|
||||
}
|
||||
@ -507,7 +503,7 @@ class Dropdown {
|
||||
sel.parentElement.replaceChild(drop.create(), sel);
|
||||
}
|
||||
return dom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default Dropdown;
|
Loading…
x
Reference in New Issue
Block a user