mirror of https://github.com/Budibase/budibase.git
14 changed files with 302 additions and 124 deletions
@ -0,0 +1,63 @@ |
|||
<script> |
|||
let pages = [1, 2, 3] |
|||
|
|||
export let data = [] |
|||
export let pageSize = 10 |
|||
</script> |
|||
|
|||
<section> |
|||
<table class="uk-table"> |
|||
<caption>Shoe Database</caption> |
|||
<thead> |
|||
<tr> |
|||
<th>Table Heading</th> |
|||
<th>Table Heading</th> |
|||
<th>Table Heading</th> |
|||
</tr> |
|||
</thead> |
|||
<tfoot> |
|||
<tr> |
|||
<td>Table Footer</td> |
|||
<td>Table Footer</td> |
|||
<td>Table Footer</td> |
|||
</tr> |
|||
</tfoot> |
|||
<tbody> |
|||
<tr> |
|||
<td>Table Data</td> |
|||
<td>Table Data</td> |
|||
<td>Table Data</td> |
|||
</tr> |
|||
<tr> |
|||
<td>Table Data</td> |
|||
<td>Table Data</td> |
|||
<td>Table Data</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<div class="pagination"> |
|||
<button>Previous</button> |
|||
<button>Next</button> |
|||
{#each data as page} |
|||
<button>{page}</button> |
|||
{/each} |
|||
</div> |
|||
</section> |
|||
|
|||
<style> |
|||
table { |
|||
border: 1px solid #ccc; |
|||
} |
|||
|
|||
thead { |
|||
background: var(--background-button); |
|||
} |
|||
|
|||
thead th { |
|||
color: var(--button-text); |
|||
text-transform: capitalize; |
|||
} |
|||
tr { |
|||
border-bottom: 1px solid #ccc; |
|||
} |
|||
</style> |
|||
@ -0,0 +1 @@ |
|||
export { default } from "./ModelDataTable.svelte" |
|||
@ -0,0 +1,119 @@ |
|||
<script> |
|||
import { store } from "../builderStore" |
|||
import HierarchyRow from "./HierarchyRow.svelte" |
|||
import DropdownButton from "../common/DropdownButton.svelte" |
|||
import { hierarchy as hierarchyFunctions } from "../../../core/src" |
|||
import NavItem from "./NavItem.svelte" |
|||
import getIcon from "../common/icon" |
|||
|
|||
const newRootRecord = () => { |
|||
store.newRootRecord() |
|||
} |
|||
|
|||
const newRootIndex = () => { |
|||
store.newRootIndex() |
|||
} |
|||
|
|||
const newChildRecord = () => { |
|||
store.newChildRecord() |
|||
} |
|||
|
|||
const newChildIndex = () => { |
|||
store.newChildIndex() |
|||
} |
|||
|
|||
const defaultNewChildActions = [ |
|||
{ |
|||
label: "New Root Record", |
|||
onclick: newRootRecord, |
|||
}, |
|||
{ |
|||
label: "New Root Index", |
|||
onclick: newRootIndex, |
|||
}, |
|||
] |
|||
|
|||
let newChildActions = defaultNewChildActions |
|||
|
|||
const setActiveNav = name => () => { |
|||
store.setActiveNav(name) |
|||
} |
|||
|
|||
store.subscribe(db => { |
|||
if (!db.currentNode || hierarchyFunctions.isIndex(db.currentNode)) { |
|||
newChildActions = defaultNewChildActions |
|||
} else { |
|||
newChildActions = [ |
|||
{ |
|||
label: "New Root Record", |
|||
onclick: newRootRecord, |
|||
}, |
|||
{ |
|||
label: "New Root Index", |
|||
onclick: newRootIndex, |
|||
}, |
|||
{ |
|||
label: `New Child Record of ${db.currentNode.name}`, |
|||
onclick: newChildRecord, |
|||
}, |
|||
{ |
|||
label: `New Index on ${db.currentNode.name}`, |
|||
onclick: newChildIndex, |
|||
}, |
|||
] |
|||
} |
|||
}) |
|||
</script> |
|||
|
|||
<div class="items-root"> |
|||
<div class="hierarchy"> |
|||
<div class="components-list-container"> |
|||
<div class="nav-group-header"> |
|||
<div class="hierarchy-title">Schema</div> |
|||
<DropdownButton iconName="plus" actions={newChildActions} /> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="hierarchy-items-container"> |
|||
{#each $store.hierarchy.children as record} |
|||
<HierarchyRow node={record} type="record" /> |
|||
{/each} |
|||
|
|||
{#each $store.hierarchy.indexes as index} |
|||
<HierarchyRow node={index} type="index" /> |
|||
{/each} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
<style> |
|||
.items-root { |
|||
display: flex; |
|||
flex-direction: column; |
|||
max-height: 100%; |
|||
height: 100%; |
|||
background-color: var(--secondary5); |
|||
} |
|||
|
|||
.nav-group-header { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
padding: 2rem 1rem 1rem 1rem; |
|||
} |
|||
|
|||
.hierarchy-title { |
|||
align-items: center; |
|||
text-transform: uppercase; |
|||
font-size: 0.85em; |
|||
} |
|||
|
|||
.hierarchy { |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.hierarchy-items-container { |
|||
flex: 1 1 auto; |
|||
overflow-y: auto; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue