Skip to content

Commit

Permalink
fix(Table): hide data when loading state is active (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haythamasalama authored Jul 29, 2023
1 parent 5cf3bcf commit 2b3dc8d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@
</tr>
</thead>
<tbody :class="ui.tbody">
<tr v-for="(row, index) in rows" :key="index" :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active]" @click="() => onSelect(row)">
<td v-if="modelValue" class="ps-4">
<UCheckbox v-model="selected" :value="row" @click.stop />
</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]">
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index">
{{ row[column.key] }}
</slot>
</td>
</tr>

<tr v-if="loadingState && loading">
<td :colspan="columns.length + (modelValue ? 1 : 0)">
<slot name="loading-state">
Expand All @@ -59,6 +47,20 @@
</slot>
</td>
</tr>

<template v-else>
<tr v-for="(row, index) in rows" :key="index" :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active]" @click="() => onSelect(row)">
<td v-if="modelValue" class="ps-4">
<UCheckbox v-model="selected" :value="row" @click.stop />
</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]">
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index">
{{ row[column.key] }}
</slot>
</td>
</tr>
</template>
</tbody>
</table>
</div>
Expand Down

1 comment on commit 2b3dc8d

@vercel
Copy link

@vercel vercel bot commented on 2b3dc8d Jul 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-git-dev-nuxtlabs.vercel.app
ui-nuxtlabs.vercel.app
ui.nuxtlabs.com

Please sign in to comment.