feat: table cell button

This commit is contained in:
Torsten Dittmann committed 2024-08-08 17:42:49 +02:00
1 parent a96a3af11f
commit bc4f8ffb00
3 files changed
+30 -9

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
<script lang="ts">
export let title = '';
export let onlyDesktop = false;
export let width: number = null;
export let showOverflow = false;
let className = '';
export { className as class };
export let style = '';
export let right = false;
</script>
<button
{style}
style:--p-col-width={width?.toString() ?? ''}
class="table-col {className}"
class:u-overflow-visible={showOverflow}
class:is-only-desktop={onlyDesktop}
class:u-flex={right}
class:u-main-end={right}
data-title={title}
role="cell"
on:click
on:keypress
data-private>
<slot />
</button>
+3 -9
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { toggle } from '$lib/helpers/array';
import { isHTMLInputElement } from '$lib/helpers/types';
import { TableCell } from '.';
import { TableCellButton } from '.';
import { InputCheckbox } from '../forms';
export let id: string;
@@ -24,13 +24,7 @@
};
</script>
<TableCell>
<div
class="touch-area"
role="button"
tabindex="-1"
on:click={handleClick}
on:keypress={handleClick} />
<TableCellButton on:click={handleClick} on:keypress={handleClick}>
<InputCheckbox
bind:element={el}
id="select-{id}"
@@ -38,4 +32,4 @@
checked={selectedIds.includes(id)}
{disabled}
on:click={handleClick} />
</TableCell>
</TableCellButton>
+1
View File
@@ -8,6 +8,7 @@ export { default as TableRow } from './row.svelte';
export { default as TableRowLink } from './rowLink.svelte';
export { default as TableRowButton } from './rowButton.svelte';
export { default as TableCell } from './cell.svelte';
export { default as TableCellButton } from './cellButton.svelte';
export { default as TableCellHead } from './cellHead.svelte';
export { default as TableCellHeadCheck } from './cellHeadCheck.svelte';
export { default as TableCellLink } from './cellLink.svelte';