Improve display of relationship cell and options cell
This commit is contained in:
parent
8f5c5cc758
commit
57cfc9d84c
|
@ -73,7 +73,9 @@
|
|||
{/each}
|
||||
</div>
|
||||
{#if editable}
|
||||
<Icon name="ChevronDown" />
|
||||
<div class="arrow">
|
||||
<Icon name="ChevronDown" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if open}
|
||||
<div class="options">
|
||||
|
@ -105,11 +107,9 @@
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 8px;
|
||||
align-items: stretch;
|
||||
align-self: stretch;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
gap: 4px;
|
||||
}
|
||||
.container.editable:hover {
|
||||
cursor: pointer;
|
||||
|
@ -123,6 +123,7 @@
|
|||
width: 0;
|
||||
gap: 4px;
|
||||
overflow: hidden;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.text {
|
||||
overflow: hidden;
|
||||
|
@ -138,6 +139,20 @@
|
|||
border-radius: 8px;
|
||||
user-select: none;
|
||||
}
|
||||
.arrow {
|
||||
position: absolute;
|
||||
right: 2px;
|
||||
top: 2px;
|
||||
bottom: 2px;
|
||||
padding: 0 6px 0 16px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
transparent 0%,
|
||||
var(--background) 40%
|
||||
);
|
||||
}
|
||||
.options {
|
||||
min-width: 100%;
|
||||
position: absolute;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<script>
|
||||
export let value
|
||||
|
||||
$: console.log(value)
|
||||
|
||||
const getColor = idx => {
|
||||
if (!value || idx === -1) {
|
||||
return null
|
||||
}
|
||||
return `hsla(${((idx + 1) * 222) % 360}, 90%, 75%, 0.3)`
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
{#each value || [] as relationship, idx}
|
||||
<div class="badge" style="--color: {getColor(idx)}">
|
||||
{relationship.primaryDisplay}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 0 8px;
|
||||
flex: 1 1 auto;
|
||||
width: 0;
|
||||
gap: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.badge {
|
||||
flex: 0 0 auto;
|
||||
padding: 2px 8px;
|
||||
background: var(--color);
|
||||
border-radius: 8px;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
|
@ -7,6 +7,7 @@
|
|||
import DateCell from "./DateCell.svelte"
|
||||
import MultiSelectCell from "./MultiSelectCell.svelte"
|
||||
import NumberCell from "./NumberCell.svelte"
|
||||
import RelationshipCell from "./RelationshipCell.svelte"
|
||||
|
||||
export let table
|
||||
export let filter
|
||||
|
@ -96,6 +97,8 @@
|
|||
return MultiSelectCell
|
||||
} else if (type === "number") {
|
||||
return NumberCell
|
||||
} else if (type === "link") {
|
||||
return RelationshipCell
|
||||
}
|
||||
return TextCell
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue