Files
windmill/frontend/src/lib/components/TableSimple.svelte
T
Faton Ramadani 38421684ed Various fix (#2032)
* fix(frontend): Before legacy code + add confirmation modal when removing a user + fix folder stats

* fix(frontend): Add Date type narrowing

* fix(frontend): Add missing fullscreen in ScriptEditorDrawer

* fix(frontend): Check if we have un-saved changes before navigating to the homepage

* fix(frontend): correctly use the keyed each

* fix(frontend): add DateTimeInput

* fix(frontend): add DateTimeInput

* fix(frontend): add DateTimeInput

* fix(frontend): code cleanup

* fix(frontend): Set default time to 00:00
2023-08-11 18:38:45 +02:00

39 lines
893 B
Svelte

<script lang="ts">
import Cell from './table/Cell.svelte'
import DataTable from './table/DataTable.svelte'
import Head from './table/Head.svelte'
export let headers: string[] | undefined
export let data: any[] | undefined // Object containing the data
export let keys: string[]
</script>
<div class="mt-2">
<DataTable>
<Head>
<tr>
{#if headers}
{#each headers as header, i}
<Cell first={i == 0} last={i == headers.length - 1} head>{header}</Cell>
{/each}
{/if}
</tr>
</Head>
<tbody class="divide-y">
{#if data && keys && data.length > 0}
{#each data as row}
<tr>
{#each keys as key, i}
<Cell first={i == 0} last={i == keys.length - 1} class="w-1/3 whitespace-pre-wrap">
{row[key] ?? ''}
</Cell>
{/each}
</tr>
{/each}
{:else}
<tr>Loading...</tr>
{/if}
</tbody>
</DataTable>
</div>