1
1
<template >
2
- <div :id =" uid " :style =" tableStyle" class =" cv-data-table" >
2
+ <div :id =" cvId " :style =" tableStyle" class =" cv-data-table" >
3
3
<div
4
4
:class =" [
5
5
`${carbonPrefix}--data-table-container`,
55
55
<div
56
56
v-if =" onSearch"
57
57
ref =" searchContainer"
58
- :aria-labelledby =" `${uid }-search`"
58
+ :aria-labelledby =" `${cvId }-search`"
59
59
:class =" [
60
60
`${carbonPrefix}--search `,
61
61
{
73
73
<Search16 :class =" `${carbonPrefix}--search-magnifier-icon`" />
74
74
</div >
75
75
<label
76
- :id =" `${uid }-search`"
77
- :for =" `searchbox-${uid }`"
76
+ :id =" `${cvId }-search`"
77
+ :for =" `searchbox-${cvId }`"
78
78
:class =" `${carbonPrefix}--label`"
79
79
>{{ searchLabel }}</label
80
80
>
81
81
<input
82
- :id =" `searchbox-${uid }`"
82
+ :id =" `searchbox-${cvId }`"
83
83
ref =" search"
84
84
v-model =" searchValue"
85
85
:class =" `${carbonPrefix}--search-input`"
86
86
type =" text"
87
87
role =" searchbox"
88
88
:placeholder =" searchPlaceholder"
89
- :aria-labelledby =" `searchbox-${uid }`"
89
+ :aria-labelledby =" `searchbox-${cvId }`"
90
90
@input =" onInternalSearch"
91
91
@click =" checkSearchExpand(true)"
92
92
@keydown.esc.prevent =" checkSearchExpand(false)"
160
160
<cv-checkbox-skeleton v-if =" isSkeleton" />
161
161
<cv-checkbox
162
162
v-else
163
+ :id =" `${cvId}-headingCheck`"
163
164
v-model =" headingChecked"
164
165
:form-item =" false"
165
166
value =" headingCheck"
187
188
<slot name =" data" >
188
189
<cv-data-table-row
189
190
v-for =" (row, rowIndex) in data"
191
+ :id =" `${cvId}-${rowIndex}`"
190
192
:key =" `row:${rowIndex}`"
191
193
ref =" dataRows"
192
194
:value =" `${rowIndex}`"
211
213
<cv-pagination
212
214
v-if =" pagination"
213
215
v-bind =" internalPagination"
216
+ :id =" `${cvId}-pagination`"
214
217
:number-of-items =" internalNumberOfItems"
215
218
@change =" $emit('pagination', $event)"
216
219
>
@@ -343,7 +346,7 @@ const props = defineProps({
343
346
onSearch: { type: Function , default: undefined },
344
347
... propsCvId,
345
348
});
346
- const uid = useCvId (props, true );
349
+ const cvId = useCvId (props, true );
347
350
348
351
const isSkeleton = ref (props .skeleton );
349
352
provide (' is-skeleton' , isSkeleton);
@@ -361,12 +364,16 @@ const search = ref(null);
361
364
/** @type {Ref<Set<String>>} */
362
365
const expandingRowIds = ref (new Set ());
363
366
provide (' expanding-row-ids' , expandingRowIds);
367
+
368
+ const tableExpandable = ref (props .expandable );
369
+ provide (' table-expandable' , tableExpandable);
364
370
onMounted (() => {
365
371
if (props .expandable ) expandingRowIds .value .add (' table-expand-row' );
366
372
});
367
373
watch (
368
374
() => props .expandable ,
369
375
() => {
376
+ tableExpandable .value = props .expandable ;
370
377
if (props .expandable ) expandingRowIds .value .add (' table-expand-row' );
371
378
else expandingRowIds .value .delete (' table-expand-row' );
372
379
}
0 commit comments