-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add clickable and hoverable rows to table
- Loading branch information
1 parent
3ee8452
commit fec030e
Showing
8 changed files
with
164 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/visualizations/src/components/Table/Cell/ZoomIcon.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script lang="ts"> | ||
</script> | ||
|
||
<!-- eslint-disable max-len --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> | ||
<path | ||
d="M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z" | ||
/> | ||
</svg> | ||
|
||
<style> | ||
path { | ||
color: currentColor; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import Cell from './Cell'; | ||
import type { Column, Rows } from './types'; | ||
export let columns: Column[]; | ||
export let rows: Rows | undefined; | ||
export let record: Record<string, unknown>; | ||
let isRowHovered = false; | ||
$: onMouseEnter = () => { | ||
if (rows?.onMouseEnter) { | ||
rows.onMouseEnter(record); | ||
} | ||
isRowHovered = true; | ||
}; | ||
$: onMouseLeave = () => { | ||
if (rows?.onMouseLeave) { | ||
rows.onMouseLeave(record); | ||
} | ||
isRowHovered = false; | ||
}; | ||
$: onClick = () => { | ||
if (rows?.onClick) { | ||
rows.onClick(record); | ||
} | ||
}; | ||
</script> | ||
|
||
<tr on:mouseenter={onMouseEnter} on:mouseleave={onMouseLeave}> | ||
{#each columns as column, index} | ||
<Cell | ||
rawValue={record[column.key]} | ||
{column} | ||
onClick={index === 0 && rows?.onClick ? onClick : null} | ||
{isRowHovered} | ||
/> | ||
{/each} | ||
</tr> | ||
|
||
<!-- markup (zero or more items) goes here --> | ||
|
||
<style> | ||
:global(.ods-dataviz--default) tr { | ||
border-bottom: 1px solid var(--border-color); | ||
} | ||
:global(.ods-dataviz--default) tr:last-child { | ||
border-bottom: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters