Add field type to backend table headers

This commit is contained in:
Andrew Kingston 2021-02-19 14:05:54 +00:00
parent e021b55704
commit 10d6fb44e2
2 changed files with 40 additions and 13 deletions

View File

@ -301,4 +301,13 @@
padding-top: var(--spacing-xs); padding-top: var(--spacing-xs);
padding-bottom: var(--spacing-xs); padding-bottom: var(--spacing-xs);
} }
:global(.ag-header) {
height: 61px !important;
min-height: 61px !important;
}
:global(.ag-header-row) {
height: 60px !important;
}
</style> </style>

View File

@ -2,6 +2,7 @@
import { onMount, onDestroy } from "svelte" import { onMount, onDestroy } from "svelte"
import { Modal, ModalContent } from "@budibase/bbui" import { Modal, ModalContent } from "@budibase/bbui"
import CreateEditColumn from "../modals/CreateEditColumn.svelte" import CreateEditColumn from "../modals/CreateEditColumn.svelte"
import { FIELDS } from "constants/backend"
const SORT_ICON_MAP = { const SORT_ICON_MAP = {
asc: "ri-arrow-down-fill", asc: "ri-arrow-down-fill",
@ -51,6 +52,8 @@
column.removeEventListener("sortChanged", setSort) column.removeEventListener("sortChanged", setSort)
column.removeEventListener("filterActiveChanged", setFilterActive) column.removeEventListener("filterActiveChanged", setFilterActive)
}) })
$: type = FIELDS[field.type.toUpperCase()]?.name
</script> </script>
<header <header
@ -58,12 +61,15 @@
data-cy="table-header" data-cy="table-header"
on:mouseover={() => (hovered = true)} on:mouseover={() => (hovered = true)}
on:mouseleave={() => (hovered = false)}> on:mouseleave={() => (hovered = false)}>
<div> <div class="column-header">
<div class="col-icon"> {#if field.autocolumn}<i class="auto ri-magic-fill" />{/if}
{#if field.autocolumn}<i class="auto ri-magic-fill" />{/if} <div class="column-header-text">
<span class="column-header-name">{displayName}</span> <div class="column-header-name">{displayName}</div>
{#if type}
<div class="column-header-type">{type}</div>
{/if}
</div> </div>
<i class={`${SORT_ICON_MAP[sortDirection]} sort-icon icon`} /> <i class={`${SORT_ICON_MAP[sortDirection]} icon`} />
</div> </div>
<Modal bind:this={modal}> <Modal bind:this={modal}>
<ModalContent <ModalContent
@ -106,6 +112,23 @@
opacity: 1; opacity: 1;
} }
.column-header {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: var(--spacing-s);
}
.column-header-text {
flex: 1 1 auto;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: var(--spacing-xs);
}
.column-header-name { .column-header-name {
white-space: normal !important; white-space: normal !important;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -115,9 +138,9 @@
overflow: hidden; overflow: hidden;
} }
.sort-icon { .column-header-type {
position: relative; font-size: var(--font-size-xs);
top: 2px; color: var(--grey-6);
} }
.icon { .icon {
@ -125,11 +148,6 @@
font-size: var(--font-size-m); font-size: var(--font-size-m);
font-weight: 500; font-weight: 500;
} }
.col-icon {
display: flex;
}
.auto { .auto {
font-size: var(--font-size-xs); font-size: var(--font-size-xs);
transition: none; transition: none;