Skip to content

Commit

Permalink
fix: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
portikM committed Dec 13, 2024
1 parent 826a243 commit 0203544
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/KSelect/KSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,12 @@ watch(() => props.items, (newValue, oldValue) => {
}
for (let i = 0; i < selectItems.value?.length; i++) {
// Ensure each item has a `selected` property
// Ensure each item has a selected property
if (selectItems.value[i].selected === undefined) {
selectItems.value[i].selected = false
}
// ensure each item has a unique key property
let selectItemKey = `${selectItems.value[i].label?.replace(/ /gi, '-')?.replace(/[^a-z0-9-_]/gi, '')}-${i}`
if (selectItemKey.includes('undefined')) {
selectItemKey = `select-item-label-${i}`
Expand Down
2 changes: 2 additions & 0 deletions src/components/KSelect/KSelectItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
v-for="item in nonGroupedItems"
:key="item.key"
ref="kSelectItem"
:data-key="item.key"
:item="item"
@arrow-down="() => shiftFocus(item.key, 'down')"
@arrow-up="() => shiftFocus(item.key, 'up')"
Expand Down Expand Up @@ -30,6 +31,7 @@
v-for="item in getGroupItems(group)"
:key="item.key"
ref="kSelectItem"
:data-key="item.key"
:item="item"
@arrow-down="() => shiftFocus(item.key, 'down')"
@arrow-up="() => shiftFocus(item.key, 'up')"
Expand Down

0 comments on commit 0203544

Please sign in to comment.