Change anyHidden to anyRestricted

This commit is contained in:
Adria Navarro 2024-05-31 11:14:41 +02:00
parent 4dbfa28feb
commit 5444655237
1 changed files with 4 additions and 10 deletions

View File

@ -12,8 +12,9 @@
let open = false
let anchor
$: anyHidden = $columns.some(col => !col.visible)
$: text = getText($columns)
$: restrictedColumns = $columns.filter(col => !col.visible || col.readonly)
$: anyRestricted = restrictedColumns.length
$: text = anyRestricted ? `Columns (${anyRestricted} restricted)` : "Columns"
const toggleColumn = async (column, permission) => {
const visible = permission !== PERMISSION_OPTIONS.HIDDEN
@ -28,13 +29,6 @@
dispatch(visible ? "show-column" : "hide-column")
}
const getText = columns => {
const restricted = columns.filter(
col => !col.visible || col.readonly
).length
return restricted ? `Columns (${restricted} restricted)` : "Columns"
}
const PERMISSION_OPTIONS = {
WRITABLE: "writable",
READONLY: "readonly",
@ -83,7 +77,7 @@
quiet
size="M"
on:click={() => (open = !open)}
selected={open || anyHidden}
selected={open || anyRestricted}
disabled={!$columns.length}
>
{text}