Skip to content

Commit a6cc017

Browse files
committed
Merge branch 'develop-patch' into develop-minor
2 parents a037329 + 95abcf2 commit a6cc017

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
@@ -31,18 +31,18 @@
3131
@change="$emit('change', $event)"
3232
@end="$emit('sort', items, $event)"
3333
>
34-
<template v-for="(item, itemIndex) in items">
34+
<template v-for="(item, itemIndex) in itemsWithIds">
3535
<slot v-bind="{ item, itemIndex }">
3636
<k-item
37-
:key="item.id ?? itemIndex"
37+
:key="item.id"
3838
v-bind="item"
39-
:class="{ 'k-draggable-item': sortable && item.sortable }"
39+
:class="{ 'k-draggable-item': sortable && item.sortable !== false }"
4040
:image="imageOptions(item)"
4141
:layout="layout"
4242
:link="link ? item.link : false"
4343
:selecting="selecting"
4444
:selectable="item.selectable"
45-
:sortable="sortable && item.sortable"
45+
:sortable="sortable && item.sortable !== false"
4646
:theme="item.theme ?? theme"
4747
:width="item.column"
4848
@click="$emit('item', item, itemIndex)"
@@ -143,6 +143,16 @@ export default {
143143
draggable: ".k-draggable-item"
144144
};
145145
},
146+
/**
147+
* Adds a unique id to each item if it doesn't have one
148+
* to be used for `:key` in the `v-for` loop
149+
*/
150+
itemsWithIds() {
151+
return this.items.map((item) => ({
152+
...item,
153+
id: item.id ?? item.uuid ?? this.$helper.uuid()
154+
}));
155+
},
146156
table() {
147157
return {
148158
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)