2021-04-08 16:57:24 +02:00
|
|
|
<script>
|
|
|
|
import { createEventDispatcher } from "svelte"
|
|
|
|
import "@spectrum-css/table/dist/index-vars.css"
|
|
|
|
import CellRenderer from "./CellRenderer.svelte"
|
|
|
|
import SelectEditRenderer from "./SelectEditRenderer.svelte"
|
2022-01-31 19:58:19 +01:00
|
|
|
import { cloneDeep, deepGet } from "../helpers"
|
2021-04-08 16:57:24 +02:00
|
|
|
|
2021-05-14 14:11:23 +02:00
|
|
|
/**
|
|
|
|
* The expected schema is our normal couch schemas for our tables.
|
|
|
|
* Each field schema can be enriched with a few extra properties to customise
|
|
|
|
* the behaviour.
|
|
|
|
* All of these are optional and do not need to be added.
|
|
|
|
* displayName: Overrides the field name displayed as the column title
|
|
|
|
* sortable: Set to false to disable sorting data by a certain column
|
|
|
|
* editable: Set to false to disable editing a certain column if the
|
|
|
|
* allowEditColumns prop is true
|
|
|
|
*/
|
2021-04-08 16:57:24 +02:00
|
|
|
export let data = []
|
|
|
|
export let schema = {}
|
|
|
|
export let showAutoColumns = false
|
2021-04-13 15:14:14 +02:00
|
|
|
export let rowCount = 0
|
2021-04-15 12:50:56 +02:00
|
|
|
export let quiet = false
|
2021-04-08 16:57:24 +02:00
|
|
|
export let loading = false
|
|
|
|
export let allowSelectRows = true
|
|
|
|
export let allowEditRows = true
|
|
|
|
export let allowEditColumns = true
|
|
|
|
export let selectedRows = []
|
2021-04-12 15:45:41 +02:00
|
|
|
export let editColumnTitle = "Edit"
|
2021-04-09 15:21:27 +02:00
|
|
|
export let customRenderers = []
|
2021-09-23 17:08:09 +02:00
|
|
|
export let disableSorting = false
|
2022-02-18 13:35:39 +01:00
|
|
|
export let autoSortColumns = true
|
2022-02-18 14:08:18 +01:00
|
|
|
export let compact = false
|
2021-04-08 16:57:24 +02:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
|
|
|
|
// Config
|
2022-02-18 14:08:18 +01:00
|
|
|
$: rowHeight = compact ? 46 : 55
|
2021-04-08 16:57:24 +02:00
|
|
|
const headerHeight = 36
|
|
|
|
const rowPreload = 5
|
|
|
|
|
|
|
|
// Sorting state
|
|
|
|
let sortColumn
|
|
|
|
let sortOrder
|
|
|
|
|
|
|
|
// Table state
|
2021-04-13 15:14:14 +02:00
|
|
|
let height = 0
|
2021-04-08 16:57:24 +02:00
|
|
|
let loaded = false
|
2021-05-04 12:04:42 +02:00
|
|
|
$: schema = fixSchema(schema)
|
2021-04-08 16:57:24 +02:00
|
|
|
$: if (!loading) loaded = true
|
2022-02-18 13:35:39 +01:00
|
|
|
$: fields = getFields(schema, showAutoColumns, autoSortColumns)
|
2022-02-18 12:58:18 +01:00
|
|
|
$: rows = fields?.length ? data || [] : []
|
2021-04-13 15:14:14 +02:00
|
|
|
$: visibleRowCount = getVisibleRowCount(loaded, height, rows.length, rowCount)
|
|
|
|
$: contentStyle = getContentStyle(visibleRowCount, rowCount)
|
2021-04-08 16:57:24 +02:00
|
|
|
$: sortedRows = sortRows(rows, sortColumn, sortOrder)
|
2022-02-18 12:58:18 +01:00
|
|
|
$: gridStyle = getGridStyle(fields, schema, showEditColumn)
|
2021-04-12 15:45:41 +02:00
|
|
|
$: showEditColumn = allowEditRows || allowSelectRows
|
2021-04-08 16:57:24 +02:00
|
|
|
|
|
|
|
// Scrolling state
|
|
|
|
let timeout
|
|
|
|
let nextScrollTop = 0
|
|
|
|
let scrollTop = 0
|
|
|
|
$: firstVisibleRow = calculateFirstVisibleRow(scrollTop)
|
|
|
|
$: lastVisibleRow = calculateLastVisibleRow(
|
|
|
|
firstVisibleRow,
|
|
|
|
visibleRowCount,
|
|
|
|
rows.length
|
|
|
|
)
|
|
|
|
|
2021-05-04 12:04:42 +02:00
|
|
|
// Reset state when data changes
|
2021-09-29 16:25:44 +02:00
|
|
|
$: rows.length, reset()
|
2021-04-13 16:10:27 +02:00
|
|
|
const reset = () => {
|
|
|
|
nextScrollTop = 0
|
|
|
|
scrollTop = 0
|
|
|
|
clearTimeout(timeout)
|
|
|
|
timeout = null
|
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const fixSchema = schema => {
|
2021-05-04 12:04:42 +02:00
|
|
|
let fixedSchema = {}
|
|
|
|
Object.entries(schema || {}).forEach(([fieldName, fieldSchema]) => {
|
|
|
|
if (typeof fieldSchema === "string") {
|
|
|
|
fixedSchema[fieldName] = {
|
|
|
|
type: fieldSchema,
|
|
|
|
name: fieldName,
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fixedSchema[fieldName] = {
|
|
|
|
...fieldSchema,
|
|
|
|
name: fieldName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
return fixedSchema
|
|
|
|
}
|
|
|
|
|
2021-04-13 15:14:14 +02:00
|
|
|
const getVisibleRowCount = (loaded, height, allRows, rowCount) => {
|
|
|
|
if (!loaded) {
|
|
|
|
return rowCount || 0
|
|
|
|
}
|
|
|
|
if (rowCount) {
|
|
|
|
return Math.min(allRows, rowCount)
|
|
|
|
}
|
|
|
|
return Math.min(allRows, Math.ceil(height / rowHeight))
|
|
|
|
}
|
|
|
|
|
|
|
|
const getContentStyle = (visibleRows, rowCount) => {
|
2021-04-16 12:03:44 +02:00
|
|
|
if (!rowCount || !visibleRows) {
|
2021-04-08 16:57:24 +02:00
|
|
|
return ""
|
|
|
|
}
|
2021-04-16 10:39:49 +02:00
|
|
|
return `height: ${headerHeight + visibleRows * (rowHeight + 1)}px;`
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
|
2022-02-18 12:58:18 +01:00
|
|
|
const getGridStyle = (fields, schema, showEditColumn) => {
|
|
|
|
let style = "grid-template-columns:"
|
|
|
|
if (showEditColumn) {
|
|
|
|
style += " auto"
|
|
|
|
}
|
|
|
|
fields?.forEach(field => {
|
|
|
|
const fieldSchema = schema[field]
|
|
|
|
if (fieldSchema.width) {
|
|
|
|
style += ` ${fieldSchema.width}`
|
|
|
|
} else {
|
|
|
|
style += " minmax(auto, 1fr)"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
style += ";"
|
|
|
|
return style
|
|
|
|
}
|
|
|
|
|
2021-04-08 16:57:24 +02:00
|
|
|
const sortRows = (rows, sortColumn, sortOrder) => {
|
2021-09-23 17:08:09 +02:00
|
|
|
if (!sortColumn || !sortOrder || disableSorting) {
|
2021-04-08 16:57:24 +02:00
|
|
|
return rows
|
|
|
|
}
|
|
|
|
return rows.slice().sort((a, b) => {
|
|
|
|
const colA = a[sortColumn]
|
|
|
|
const colB = b[sortColumn]
|
|
|
|
if (sortOrder === "Descending") {
|
|
|
|
return colA > colB ? -1 : 1
|
|
|
|
} else {
|
|
|
|
return colA > colB ? 1 : -1
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const sortBy = fieldSchema => {
|
2021-04-13 15:44:30 +02:00
|
|
|
if (fieldSchema.sortable === false) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (fieldSchema.name === sortColumn) {
|
2021-04-08 16:57:24 +02:00
|
|
|
sortOrder = sortOrder === "Descending" ? "Ascending" : "Descending"
|
|
|
|
} else {
|
2021-04-13 15:44:30 +02:00
|
|
|
sortColumn = fieldSchema.name
|
2021-04-08 16:57:24 +02:00
|
|
|
sortOrder = "Descending"
|
|
|
|
}
|
2021-09-23 17:08:09 +02:00
|
|
|
dispatch("sort", { column: sortColumn, order: sortOrder })
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const getDisplayName = schema => {
|
2021-04-12 17:14:24 +02:00
|
|
|
let name = schema?.displayName
|
|
|
|
if (schema && name === undefined) {
|
|
|
|
name = schema.name
|
|
|
|
}
|
|
|
|
return name || ""
|
|
|
|
}
|
|
|
|
|
2022-02-18 13:35:39 +01:00
|
|
|
const getFields = (schema, showAutoColumns, autoSortColumns) => {
|
2021-04-08 16:57:24 +02:00
|
|
|
let columns = []
|
|
|
|
let autoColumns = []
|
2021-04-09 15:48:26 +02:00
|
|
|
Object.entries(schema || {}).forEach(([field, fieldSchema]) => {
|
2021-04-12 17:14:24 +02:00
|
|
|
if (!field || !fieldSchema) {
|
|
|
|
return
|
|
|
|
}
|
2022-02-18 13:35:39 +01:00
|
|
|
if (!autoSortColumns || !fieldSchema?.autocolumn) {
|
2021-04-12 17:14:24 +02:00
|
|
|
columns.push(fieldSchema)
|
2021-04-08 16:57:24 +02:00
|
|
|
} else if (showAutoColumns) {
|
2021-04-12 17:14:24 +02:00
|
|
|
autoColumns.push(fieldSchema)
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
})
|
2021-04-09 15:21:27 +02:00
|
|
|
return columns
|
|
|
|
.sort((a, b) => {
|
2021-04-12 17:14:24 +02:00
|
|
|
const orderA = a.order || Number.MAX_SAFE_INTEGER
|
|
|
|
const orderB = b.order || Number.MAX_SAFE_INTEGER
|
|
|
|
const nameA = getDisplayName(a)
|
|
|
|
const nameB = getDisplayName(b)
|
|
|
|
if (orderA !== orderB) {
|
|
|
|
return orderA < orderB ? orderA : orderB
|
|
|
|
}
|
|
|
|
return nameA < nameB ? a : b
|
2021-04-09 15:21:27 +02:00
|
|
|
})
|
|
|
|
.concat(autoColumns)
|
2021-05-04 12:32:22 +02:00
|
|
|
.map(column => column.name)
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const onScroll = event => {
|
2021-04-08 16:57:24 +02:00
|
|
|
nextScrollTop = event.target.scrollTop
|
|
|
|
if (timeout) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
timeout = setTimeout(() => {
|
|
|
|
scrollTop = nextScrollTop
|
|
|
|
timeout = null
|
|
|
|
}, 50)
|
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const calculateFirstVisibleRow = scrollTop => {
|
2021-04-08 16:57:24 +02:00
|
|
|
return Math.max(Math.floor(scrollTop / (rowHeight + 1)) - rowPreload, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
const calculateLastVisibleRow = (firstRow, visibleRowCount, allRowCount) => {
|
2021-04-13 15:14:14 +02:00
|
|
|
if (visibleRowCount === 0) {
|
2021-04-13 15:44:30 +02:00
|
|
|
return -1
|
2021-04-13 15:14:14 +02:00
|
|
|
}
|
2021-04-08 16:57:24 +02:00
|
|
|
return Math.min(firstRow + visibleRowCount + 2 * rowPreload, allRowCount)
|
|
|
|
}
|
|
|
|
|
|
|
|
const editColumn = (e, field) => {
|
|
|
|
e.stopPropagation()
|
|
|
|
dispatch("editcolumn", field)
|
|
|
|
}
|
|
|
|
|
|
|
|
const editRow = (e, row) => {
|
|
|
|
e.stopPropagation()
|
2021-09-02 15:42:12 +02:00
|
|
|
dispatch("editrow", cloneDeep(row))
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
|
2021-05-04 12:32:22 +02:00
|
|
|
const toggleSelectRow = row => {
|
2021-04-08 16:57:24 +02:00
|
|
|
if (!allowSelectRows) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (selectedRows.includes(row)) {
|
2021-05-04 12:32:22 +02:00
|
|
|
selectedRows = selectedRows.filter(selectedRow => selectedRow !== row)
|
2021-04-08 16:57:24 +02:00
|
|
|
} else {
|
|
|
|
selectedRows = [...selectedRows, row]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-18 12:58:18 +01:00
|
|
|
<div
|
|
|
|
class="wrapper"
|
|
|
|
class:wrapper--quiet={quiet}
|
2022-02-18 14:08:18 +01:00
|
|
|
class:wrapper--compact={compact}
|
2022-02-18 12:58:18 +01:00
|
|
|
bind:offsetHeight={height}
|
|
|
|
style={`--row-height: ${rowHeight}px; --header-height: ${headerHeight}px;`}
|
|
|
|
>
|
2021-04-13 15:14:14 +02:00
|
|
|
{#if !loaded}
|
|
|
|
<div class="loading" style={contentStyle} />
|
|
|
|
{:else}
|
2021-04-13 16:10:27 +02:00
|
|
|
<div
|
|
|
|
on:scroll={onScroll}
|
2022-02-18 12:58:18 +01:00
|
|
|
class="spectrum-Table"
|
|
|
|
style={`${contentStyle}${gridStyle}`}
|
2021-05-04 12:04:42 +02:00
|
|
|
>
|
2022-02-18 12:58:18 +01:00
|
|
|
{#if fields.length}
|
|
|
|
{#if showEditColumn}
|
2022-02-18 14:08:18 +01:00
|
|
|
<div class="spectrum-Table-headCell spectrum-Table-headCell--divider">
|
2022-02-18 12:58:18 +01:00
|
|
|
{editColumnTitle || ""}
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{#each fields as field}
|
|
|
|
<div
|
|
|
|
class="spectrum-Table-headCell"
|
|
|
|
class:is-sortable={schema[field].sortable !== false}
|
|
|
|
class:is-sorted-desc={sortColumn === field &&
|
|
|
|
sortOrder === "Descending"}
|
|
|
|
class:is-sorted-asc={sortColumn === field &&
|
|
|
|
sortOrder === "Ascending"}
|
|
|
|
on:click={() => sortBy(schema[field])}
|
|
|
|
>
|
|
|
|
<div class="spectrum-Table-headCell-content">
|
|
|
|
<div class="title">{getDisplayName(schema[field])}</div>
|
|
|
|
{#if schema[field]?.autocolumn}
|
|
|
|
<svg
|
|
|
|
class="spectrum-Icon spectrum-Table-autoIcon"
|
|
|
|
focusable="false"
|
|
|
|
>
|
|
|
|
<use xlink:href="#spectrum-icon-18-MagicWand" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
{#if sortColumn === field}
|
|
|
|
<svg
|
|
|
|
class="spectrum-Icon spectrum-UIIcon-ArrowDown100 spectrum-Table-sortedIcon"
|
|
|
|
focusable="false"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<use xlink:href="#spectrum-css-icon-Arrow100" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
{#if allowEditColumns && schema[field]?.editable !== false}
|
|
|
|
<svg
|
|
|
|
class="spectrum-Icon spectrum-Table-editIcon"
|
|
|
|
focusable="false"
|
|
|
|
on:click={e => editColumn(e, field)}
|
|
|
|
>
|
|
|
|
<use xlink:href="#spectrum-icon-18-Edit" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
{/if}
|
|
|
|
{#if sortedRows?.length}
|
|
|
|
{#each sortedRows as row, idx}
|
|
|
|
<div
|
|
|
|
class="spectrum-Table-row"
|
|
|
|
on:click={() => dispatch("click", row)}
|
|
|
|
on:click={() => toggleSelectRow(row)}
|
|
|
|
>
|
|
|
|
{#if idx >= firstVisibleRow && idx <= lastVisibleRow}
|
|
|
|
{#if showEditColumn}
|
2022-02-18 14:08:18 +01:00
|
|
|
<div class="spectrum-Table-cell spectrum-Table-cell--divider">
|
2022-02-18 12:58:18 +01:00
|
|
|
<SelectEditRenderer
|
|
|
|
data={row}
|
|
|
|
selected={selectedRows.includes(row)}
|
|
|
|
onToggleSelection={() => toggleSelectRow(row)}
|
|
|
|
onEdit={e => editRow(e, row)}
|
|
|
|
{allowSelectRows}
|
|
|
|
{allowEditRows}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{#each fields as field}
|
|
|
|
<div
|
|
|
|
class="spectrum-Table-cell"
|
|
|
|
class:spectrum-Table-cell--divider={!!schema[field].divider}
|
2021-05-04 12:04:42 +02:00
|
|
|
>
|
2022-02-18 12:58:18 +01:00
|
|
|
<CellRenderer
|
|
|
|
{customRenderers}
|
|
|
|
{row}
|
|
|
|
schema={schema[field]}
|
|
|
|
value={deepGet(row, field)}
|
|
|
|
on:clickrelationship
|
|
|
|
>
|
|
|
|
<slot />
|
|
|
|
</CellRenderer>
|
|
|
|
</div>
|
2021-04-13 16:10:27 +02:00
|
|
|
{/each}
|
|
|
|
{:else}
|
2022-02-18 12:58:18 +01:00
|
|
|
<div class="spectrum-Table-cell spectrum-Table-cell--empty" />
|
2021-04-13 16:10:27 +02:00
|
|
|
{/if}
|
2022-02-18 12:58:18 +01:00
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
{:else}
|
|
|
|
<div class="placeholder" class:placeholder--no-fields={!fields?.length}>
|
|
|
|
<div class="placeholder-content">
|
|
|
|
<svg class="spectrum-Icon spectrum-Icon--sizeXXL" focusable="false">
|
|
|
|
<use xlink:href="#spectrum-icon-18-Table" />
|
|
|
|
</svg>
|
|
|
|
<div>No rows found</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2021-04-08 16:57:24 +02:00
|
|
|
</div>
|
2021-04-13 15:14:14 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
2021-04-08 16:57:24 +02:00
|
|
|
|
|
|
|
<style>
|
2022-02-18 12:58:18 +01:00
|
|
|
/* Wrapper */
|
2021-04-13 16:10:27 +02:00
|
|
|
.wrapper {
|
2021-04-23 11:48:19 +02:00
|
|
|
background-color: var(--spectrum-alias-background-color-secondary);
|
2021-04-13 16:10:27 +02:00
|
|
|
overflow: hidden;
|
2021-04-13 16:31:38 +02:00
|
|
|
position: relative;
|
2021-06-14 19:20:25 +02:00
|
|
|
z-index: 0;
|
2022-02-18 12:58:18 +01:00
|
|
|
--table-bg: var(--spectrum-global-color-gray-50);
|
|
|
|
--table-border: 1px solid var(--spectrum-alias-border-color-mid);
|
2022-02-18 14:08:18 +01:00
|
|
|
--cell-padding: 20px;
|
2022-02-18 12:58:18 +01:00
|
|
|
}
|
|
|
|
.wrapper--quiet {
|
|
|
|
--table-bg: var(--spectrum-alias-background-color-transparent);
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
2022-02-18 14:08:18 +01:00
|
|
|
.wrapper--compact {
|
|
|
|
/*--spectrum-table-header-padding-x: 5px;*/
|
|
|
|
/*--spectrum-table-cell-padding-x: 5px;*/
|
|
|
|
--cell-padding: 12px;
|
|
|
|
}
|
2021-04-08 16:57:24 +02:00
|
|
|
|
2022-02-18 12:58:18 +01:00
|
|
|
/* Table */
|
|
|
|
.spectrum-Table {
|
|
|
|
width: 100%;
|
2021-04-08 16:57:24 +02:00
|
|
|
overflow: auto;
|
2022-02-18 12:58:18 +01:00
|
|
|
border-radius: 0;
|
|
|
|
background-color: var(--table-bg);
|
|
|
|
display: grid;
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
2022-02-18 12:58:18 +01:00
|
|
|
|
|
|
|
/* Header */
|
|
|
|
.spectrum-Table-head {
|
|
|
|
display: flex;
|
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
width: fit-content;
|
|
|
|
border-bottom: var(--table-border);
|
|
|
|
border-right: 2px solid transparent;
|
|
|
|
min-width: calc(100% - 2px);
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
2022-02-18 12:58:18 +01:00
|
|
|
.spectrum-Table-headCell {
|
|
|
|
vertical-align: middle;
|
|
|
|
height: var(--header-height);
|
|
|
|
position: sticky;
|
|
|
|
top: 0;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
background-color: var(--spectrum-alias-background-color-secondary);
|
|
|
|
z-index: 2;
|
|
|
|
border-bottom: var(--table-border);
|
2022-02-18 14:08:18 +01:00
|
|
|
padding-left: var(--cell-padding);
|
|
|
|
padding-right: 0;
|
|
|
|
}
|
|
|
|
.spectrum-Table-headCell--divider {
|
|
|
|
padding-right: var(--cell-padding);
|
2022-02-18 12:58:18 +01:00
|
|
|
}
|
|
|
|
.spectrum-Table-headCell-content {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
.spectrum-Table-headCell-content .title {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
.spectrum-Table-headCell:hover .spectrum-Table-editIcon {
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 0.2s ease;
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
.spectrum-Table-headCell .spectrum-Icon {
|
|
|
|
pointer-events: all;
|
|
|
|
margin-left: var(
|
|
|
|
--spectrum-table-header-sort-icon-gap,
|
|
|
|
var(--spectrum-global-dimension-size-125)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
.spectrum-Table-editIcon,
|
|
|
|
.spectrum-Table-autoIcon {
|
|
|
|
width: var(--spectrum-global-dimension-size-150);
|
|
|
|
height: var(--spectrum-global-dimension-size-150);
|
|
|
|
}
|
|
|
|
.spectrum-Table-editIcon {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
2022-02-18 12:58:18 +01:00
|
|
|
/* Table rows */
|
|
|
|
.spectrum-Table-row {
|
|
|
|
display: contents;
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
2022-02-18 12:58:18 +01:00
|
|
|
.spectrum-Table-row:hover .spectrum-Table-cell {
|
|
|
|
background-color: var(--spectrum-alias-highlight-hover);
|
|
|
|
}
|
|
|
|
.wrapper--quiet .spectrum-Table-row {
|
|
|
|
border-left: none;
|
|
|
|
border-right: none;
|
|
|
|
}
|
|
|
|
.spectrum-Table-row > :first-child {
|
|
|
|
border-left: var(--table-border);
|
|
|
|
}
|
|
|
|
.spectrum-Table-row > :last-child {
|
|
|
|
border-right: var(--table-border);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Table cells */
|
|
|
|
.spectrum-Table-cell {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
padding-top: 0;
|
|
|
|
padding-bottom: 0;
|
|
|
|
border-top: none;
|
|
|
|
border-bottom: none;
|
|
|
|
border-radius: 0;
|
|
|
|
text-overflow: ellipsis;
|
2021-04-08 16:57:24 +02:00
|
|
|
white-space: nowrap;
|
2022-02-18 12:58:18 +01:00
|
|
|
height: var(--row-height);
|
2021-04-08 16:57:24 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
2022-02-18 12:58:18 +01:00
|
|
|
gap: 4px;
|
|
|
|
transition: background-color
|
|
|
|
var(--spectrum-global-animation-duration-100, 0.13s) ease-in-out;
|
|
|
|
border-bottom: 1px solid var(--spectrum-alias-border-color-mid);
|
2022-02-18 14:08:18 +01:00
|
|
|
padding-left: var(--cell-padding);
|
|
|
|
padding-right: 0;
|
|
|
|
}
|
|
|
|
.spectrum-Table-cell--divider {
|
|
|
|
padding-right: var(--cell-padding);
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
2022-02-18 12:58:18 +01:00
|
|
|
.spectrum-Table-cell--empty {
|
|
|
|
grid-column: 1 / -1;
|
2021-04-08 16:57:24 +02:00
|
|
|
}
|
|
|
|
|
2022-02-18 12:58:18 +01:00
|
|
|
/* Placeholder */
|
2021-04-09 15:48:26 +02:00
|
|
|
.placeholder {
|
2021-05-10 19:01:47 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
2022-02-18 12:58:18 +01:00
|
|
|
border: var(--table-border);
|
|
|
|
border-top: none;
|
|
|
|
grid-column: 1 / -1;
|
2021-05-10 19:01:47 +02:00
|
|
|
}
|
2022-02-18 12:58:18 +01:00
|
|
|
.placeholder--no-fields {
|
|
|
|
border-top: var(--table-border);
|
|
|
|
}
|
|
|
|
.wrapper--quiet .placeholder {
|
|
|
|
border-left: none;
|
|
|
|
border-right: none;
|
2021-05-10 19:01:47 +02:00
|
|
|
}
|
|
|
|
.placeholder-content {
|
2022-02-18 12:58:18 +01:00
|
|
|
padding: 40px;
|
2021-04-09 15:48:26 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
color: var(
|
|
|
|
--spectrum-table-cell-text-color,
|
|
|
|
var(--spectrum-alias-text-color)
|
|
|
|
);
|
|
|
|
}
|
2021-05-10 19:01:47 +02:00
|
|
|
.placeholder-content div {
|
2021-04-09 15:48:26 +02:00
|
|
|
margin-top: 10px;
|
|
|
|
font-size: var(
|
|
|
|
--spectrum-table-cell-text-size,
|
|
|
|
var(--spectrum-alias-font-size-default)
|
|
|
|
);
|
2021-05-10 19:01:47 +02:00
|
|
|
text-align: center;
|
2021-04-09 15:48:26 +02:00
|
|
|
}
|
2021-04-08 16:57:24 +02:00
|
|
|
</style>
|