Skip to content

Commit 9df6515

Browse files
committed
Merge branch 'develop-minor' into v6/develop
2 parents d35b963 + a6cc017 commit 9df6515

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

panel/src/components/Collection/Items.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
@change="$emit('change', $event)"
2929
@end="$emit('sort', items, $event)"
3030
>
31-
<template v-for="(item, itemIndex) in items">
31+
<template v-for="(item, itemIndex) in itemsWithIds">
3232
<slot v-bind="{ item, itemIndex }">
3333
<k-item
34-
:key="item.id ?? itemIndex"
34+
:key="item.id"
3535
v-bind="item"
36-
:class="{ 'k-draggable-item': sortable && item.sortable }"
36+
:class="{ 'k-draggable-item': sortable && item.sortable !== false }"
3737
:image="imageOptions(item)"
3838
:layout="layout"
3939
:link="link ? item.link : false"
4040
:selecting="selecting"
4141
:selectable="item.selectable"
42-
:sortable="sortable && item.sortable"
42+
:sortable="sortable && item.sortable !== false"
4343
:theme="item.theme ?? theme"
4444
:width="item.column"
4545
@click="$emit('item', item, itemIndex)"
@@ -140,6 +140,16 @@ export default {
140140
draggable: ".k-draggable-item"
141141
};
142142
},
143+
/**
144+
* Adds a unique id to each item if it doesn't have one
145+
* to be used for `:key` in the `v-for` loop
146+
*/
147+
itemsWithIds() {
148+
return this.items.map((item) => ({
149+
...item,
150+
id: item.id ?? item.uuid ?? this.$helper.uuid()
151+
}));
152+
},
143153
table() {
144154
return {
145155
columns: this.columns,

panel/src/components/Lab/Docs/Props.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
<div class="k-table">
55
<table>
66
<thead>
7-
<th style="width: 10rem">Name</th>
8-
<th style="width: 10rem">Type</th>
9-
<th style="width: 10rem">Default</th>
10-
<th>Description</th>
7+
<tr>
8+
<th style="width: 10rem">Name</th>
9+
<th style="width: 10rem">Type</th>
10+
<th style="width: 10rem">Default</th>
11+
<th>Description</th>
12+
</tr>
1113
</thead>
1214
<tbody>
1315
<tr v-for="prop in props" :key="prop.name">

0 commit comments

Comments
 (0)