Allow table to take children
This commit is contained in:
parent
47ee98f839
commit
b6a202f54f
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue