{#if selection.length > 0}
{pluralize(selection?.length ?? 1, 'item') + ' selected'}
{/if}
{#if hiddenColumns.length > 0}
{/if}
{
const actions = [
{
displayName: 'Download JSON',
icon: Download,
action: () => {
const json = JSON.stringify(objects, null, 2)
const blob = new Blob([json], { type: 'text/json;charset=utf-8;' })
const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.setAttribute('href', url)
link.setAttribute('download', 'data.json')
link.style.visibility = 'hidden'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
}
]
if (hiddenColumns.length > 0) {
actions.push({
displayName: 'Display hidden columns',
icon: EyeIcon,
action: () => {
hiddenColumns = []
}
})
}
if (selection.length > 0) {
actions.push({
displayName: 'Clear selection',
icon: Columns,
action: () => {
selection = []
renderCount++
}
})
}
return actions
}}
>