Merge pull request #14761 from Budibase/remove-related-field-popover
Remove related fields popover
This commit is contained in:
commit
006a23b072
|
@ -27,9 +27,7 @@
|
||||||
let candidateIndex
|
let candidateIndex
|
||||||
let lastSearchId
|
let lastSearchId
|
||||||
let searching = false
|
let searching = false
|
||||||
let container
|
|
||||||
let anchor
|
let anchor
|
||||||
let relationshipFields
|
|
||||||
|
|
||||||
$: fieldValue = parseValue(value)
|
$: fieldValue = parseValue(value)
|
||||||
$: oneRowOnly = schema?.relationshipType === "one-to-many"
|
$: oneRowOnly = schema?.relationshipType === "one-to-many"
|
||||||
|
@ -56,12 +54,6 @@
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
$: showRelationshipFields =
|
|
||||||
relationshipFields &&
|
|
||||||
Object.keys(relationshipFields).length &&
|
|
||||||
focused &&
|
|
||||||
!isOpen
|
|
||||||
|
|
||||||
const parseValue = value => {
|
const parseValue = value => {
|
||||||
if (Array.isArray(value) && value.every(x => x?._id)) {
|
if (Array.isArray(value) && value.every(x => x?._id)) {
|
||||||
return value
|
return value
|
||||||
|
@ -242,14 +234,6 @@
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayRelationshipFields = relationship => {
|
|
||||||
relationshipFields = relationFields[relationship._id]
|
|
||||||
}
|
|
||||||
|
|
||||||
const hideRelationshipFields = () => {
|
|
||||||
relationshipFields = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
api = {
|
api = {
|
||||||
focus: open,
|
focus: open,
|
||||||
|
@ -269,7 +253,7 @@
|
||||||
style="--color:{color};"
|
style="--color:{color};"
|
||||||
bind:this={anchor}
|
bind:this={anchor}
|
||||||
>
|
>
|
||||||
<div class="container" bind:this={container}>
|
<div class="container">
|
||||||
<div
|
<div
|
||||||
class="values"
|
class="values"
|
||||||
class:wrap={editable || contentLines > 1}
|
class:wrap={editable || contentLines > 1}
|
||||||
|
@ -281,9 +265,7 @@
|
||||||
<div
|
<div
|
||||||
class="badge"
|
class="badge"
|
||||||
class:extra-info={!!relationFields[relationship._id]}
|
class:extra-info={!!relationFields[relationship._id]}
|
||||||
on:mouseover={() => displayRelationshipFields(relationship)}
|
|
||||||
on:focus={() => {}}
|
on:focus={() => {}}
|
||||||
on:mouseleave={() => hideRelationshipFields()}
|
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
{readable(
|
{readable(
|
||||||
|
@ -358,21 +340,6 @@
|
||||||
</GridPopover>
|
</GridPopover>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if showRelationshipFields}
|
|
||||||
<GridPopover {anchor} minWidth={300} maxWidth={400}>
|
|
||||||
<div class="relationship-fields">
|
|
||||||
{#each Object.entries(relationshipFields) as [fieldName, fieldValue]}
|
|
||||||
<div class="relationship-field-name">
|
|
||||||
{fieldName}
|
|
||||||
</div>
|
|
||||||
<div class="relationship-field-value">
|
|
||||||
{fieldValue}
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</GridPopover>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
|
@ -539,25 +506,4 @@
|
||||||
.search :global(.spectrum-Form-item) {
|
.search :global(.spectrum-Form-item) {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.relationship-fields {
|
|
||||||
margin: var(--spacing-m) var(--spacing-l);
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(auto, 50%) auto;
|
|
||||||
grid-row-gap: var(--spacing-m);
|
|
||||||
grid-column-gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
|
|
||||||
.relationship-field-name {
|
|
||||||
text-transform: uppercase;
|
|
||||||
color: var(--spectrum-global-color-gray-600);
|
|
||||||
font-size: var(--font-size-xs);
|
|
||||||
}
|
|
||||||
.relationship-field-value {
|
|
||||||
overflow: hidden;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
line-clamp: 3;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue