mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 19:56:00 +00:00
collapsible table editor parts
This commit is contained in:
@@ -12,11 +12,21 @@
|
|||||||
export let hideDisplayName = false;
|
export let hideDisplayName = false;
|
||||||
export let clickable = false;
|
export let clickable = false;
|
||||||
export let onAddNew = null;
|
export let onAddNew = null;
|
||||||
|
|
||||||
|
let collapsed = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if collection?.length > 0 || showIfEmpty || emptyMessage}
|
{#if collection?.length > 0 || showIfEmpty || emptyMessage}
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
<span
|
||||||
|
class="collapse"
|
||||||
|
on:click={() => {
|
||||||
|
collapsed = !collapsed;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FontIcon icon={collapsed ? 'icon chevron-down' : 'icon chevron-up'} />
|
||||||
|
</span>
|
||||||
<span class="title mr-1">{title}</span>
|
<span class="title mr-1">{title}</span>
|
||||||
{#if onAddNew}
|
{#if onAddNew}
|
||||||
<Link onClick={onAddNew}><FontIcon icon="icon add" /> Add new</Link>
|
<Link onClick={onAddNew}><FontIcon icon="icon add" /> Add new</Link>
|
||||||
@@ -27,7 +37,7 @@
|
|||||||
{emptyMessage}
|
{emptyMessage}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if collection?.length > 0 || showIfEmpty}
|
{#if !collapsed && (collection?.length > 0 || showIfEmpty)}
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<TableControl
|
<TableControl
|
||||||
rows={collection || []}
|
rows={collection || []}
|
||||||
@@ -78,6 +88,7 @@
|
|||||||
<style>
|
<style>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
@@ -93,4 +104,13 @@
|
|||||||
.body {
|
.body {
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.collapse {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse:hover {
|
||||||
|
color: var(--theme-font-hover);
|
||||||
|
background: var(--theme-bg-3);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user