@indielayer/ui 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.9.1";
1
+ declare const _default: "1.9.3";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = "1.9.1";
1
+ const e = "1.9.3";
2
2
  export {
3
3
  e as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indielayer/ui",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -43,6 +43,7 @@ const tableProps = {
43
43
  type: Number,
44
44
  default: 5,
45
45
  },
46
+ keyProp: String,
46
47
  }
47
48
 
48
49
  export type TableHeader = {
@@ -65,7 +66,7 @@ export default { name: 'XTable' }
65
66
  </script>
66
67
 
67
68
  <script setup lang="ts" generic="T">
68
- import { ref, type ExtractPublicPropTypes, type PropType, watch, computed, type MaybeRef } from 'vue'
69
+ import { ref, type ExtractPublicPropTypes, type PropType, watch, computed } from 'vue'
69
70
  import { useTheme, type ThemeComponent } from '../../composables/useTheme'
70
71
  import { useVirtualList } from '../../composables/useVirtualList'
71
72
 
@@ -90,9 +91,8 @@ const props = defineProps({
90
91
  },
91
92
  })
92
93
 
93
- const selectedIndex = defineModel<number | number[]>('selected')
94
-
95
- const hasSelectedIndex = computed(() => typeof selectedIndex.value === 'number')
94
+ const selected = defineModel<number | string>('selected')
95
+ const hasSelected = computed(() => typeof selected.value !== 'undefined')
96
96
 
97
97
  type internalT = T & {
98
98
  __expanded?: boolean;
@@ -257,11 +257,11 @@ const { styles, classes, className } = useTheme('Table', {}, props)
257
257
  </td>
258
258
  </tr>
259
259
  </template>
260
- <template v-for="(item, index) in list" v-else :key="index">
260
+ <template v-for="(item, index) in list" v-else :key="keyProp ?? index">
261
261
  <x-table-row
262
262
  :pointer="pointer"
263
263
  :striped="striped"
264
- :selected="hasSelectedIndex ? selectedIndex === item.index : undefined"
264
+ :selected="hasSelected ? selected === (keyProp ? (item.data as Record<string, unknown>)[keyProp] : item.index) : undefined"
265
265
  @click="$emit('click-row', item.data, item.index)"
266
266
  >
267
267
  <x-table-cell v-if="expandable" width="48" class="!p-1">
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.9.1'
1
+ export default '1.9.3'