mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-01 20:57:57 +01:00
fix(Table): checkbox still emit @select event (#3269)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -93,15 +93,17 @@
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class, column.key === 'select' && ui.checkbox.padding]">
|
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class, column.key === 'select' && ui.checkbox.padding]">
|
||||||
<slot v-if="modelValue && column.key === 'select' " name="select-data" :checked="isSelected(row)" :change="ev => onChangeCheckbox(ev, row)">
|
<!-- This is a workaround: Since the @change event doesn't bubble up naturally, we need to wrap it in another element and use @click.capture.stop to simulate event bubbling behavior -->
|
||||||
<UCheckbox
|
<span v-if="modelValue && column.key === 'select' " @click.capture.stop="() => {}">
|
||||||
:model-value="isSelected(row)"
|
<slot name="select-data" :checked="isSelected(row)" :change="(ev: boolean) => onChangeCheckbox(ev, row)">
|
||||||
v-bind="ui.default.checkbox"
|
<UCheckbox
|
||||||
aria-label="Select row"
|
:model-value="isSelected(row)"
|
||||||
@change="onChangeCheckbox($event, row)"
|
v-bind="ui.default.checkbox"
|
||||||
/>
|
aria-label="Select row"
|
||||||
</slot>
|
@change="onChangeCheckbox($event, row)"
|
||||||
|
/>
|
||||||
|
</slot>
|
||||||
|
</span>
|
||||||
<slot
|
<slot
|
||||||
v-else
|
v-else
|
||||||
:name="`${column.key}-data`"
|
:name="`${column.key}-data`"
|
||||||
|
|||||||
Reference in New Issue
Block a user