1
0
Fork 0
mirror of synced 2024-06-25 17:40:38 +12:00

Allow table to take children

This commit is contained in:
Andrew Kingston 2021-03-25 08:02:41 +00:00
parent 9dc337dfec
commit 7c79e52360
2 changed files with 21 additions and 2 deletions

View file

@ -1514,6 +1514,7 @@
"name": "Table",
"icon": "ri-table-line",
"styleable": true,
"hasChildren": true,
"settings": [
{
"type": "dataProvider",
@ -1579,6 +1580,10 @@
}
]
}
]
],
"dataContext": {
"type": "schema",
"dataProviderSetting": "dataProvider"
}
}
}

View file

@ -11,7 +11,7 @@
export let rowCount
const component = getContext("component")
const { styleable } = getContext("sdk")
const { styleable, Provider } = getContext("sdk")
let sortColumn
let sortOrder
@ -85,6 +85,11 @@
<table class="spectrum-Table">
<thead class="spectrum-Table-head">
<tr>
{#if $component.children}
<th class="spectrum-Table-headCell">
<div class="spectrum-Table-headCell-content" />
</th>
{/if}
{#each fields as field}
<th
class="spectrum-Table-headCell is-sortable"
@ -108,6 +113,15 @@
<tbody class="spectrum-Table-body">
{#each sortedRows as row}
<tr class="spectrum-Table-row">
{#if $component.children}
<td class="spectrum-Table-cell">
<div class="spectrum-Table-cell-content">
<Provider data={row}>
<slot />
</Provider>
</div>
</td>
{/if}
{#each fields as field}
<td class="spectrum-Table-cell">
<div class="spectrum-Table-cell-content">