Fixing issues and improving design.

This commit is contained in:
2020-10-05 18:23:18 -07:00
parent ee2c5ae707
commit 34ba6ee7dd
2 changed files with 26 additions and 10 deletions

View File

@@ -39,6 +39,8 @@ class ChipList extends IgniteElement {
flex-direction: column;
justify-content: center;
flex: 1;
flex-basis: auto;
flex-shrink: 1;
}
mt-chip-list > .input-container > .input {
@@ -61,6 +63,7 @@ class ChipList extends IgniteElement {
editing: false,
input: null,
searchBox: null,
search: true,
searching: false,
showSearchResults: true,
searchResults: [
@@ -72,6 +75,8 @@ class ChipList extends IgniteElement {
blurTimeout: null,
documentListener: null,
freeForm: true,
chipBackground: null,
chipColor: null
};
}
@@ -89,6 +94,8 @@ class ChipList extends IgniteElement {
new list(this.items, (item) => {
return new Chip()
.id(item.id)
.property("color", this.chipColor)
.property("background", this.chipBackground)
.property("onDelete", () => { this.items = this.items.filter(needle => needle != item); })
.child(item.content);
}),
@@ -133,7 +140,7 @@ class ChipList extends IgniteElement {
}
//If we are not searching and a key was pressed, open the search box.
if (!this.searching && (e.key !== "Backspace" || (e.key == "Backspace" && e.target.textContent.length > 1)) && (this.items == null || this.items.length < this.itemsMax)) {
if (!this.searching && this.search && (e.key !== "Backspace" || (e.key == "Backspace" && e.target.textContent.length > 1)) && (this.items == null || this.items.length < this.itemsMax)) {
this.searching = true;
this.showSearchResults = true;
} else if (this.items != null && this.items.length >= this.itemsMax && e.key !== "Backspace") {