This commit is contained in:
Adria Navarro 2023-10-09 15:36:17 +02:00
parent 0909e0547e
commit 6f77be622f
1 changed files with 12 additions and 24 deletions

View File

@ -1,6 +1,6 @@
<script>
import { getContext, onMount, tick } from "svelte"
import { FieldType, FieldSubtype } from "@budibase/types"
import { FieldType } from "@budibase/types"
import GridCell from "./GridCell.svelte"
import { Icon, Popover, Menu, MenuItem, clickOutside } from "@budibase/bbui"
import { getColumnIcon } from "../lib/utils"
@ -25,6 +25,15 @@
datasource,
} = getContext("grid")
const bannedDisplayColumnTypes = [
FieldType.LINK,
FieldType.ARRAY,
FieldType.ATTACHMENT,
FieldType.BOOLEAN,
FieldType.JSON,
FieldType.BB_REFERENCE,
]
let anchor
let open = false
let editIsOpen = false
@ -140,28 +149,6 @@
})
}
const canBeDisplayColumn = column => {
const bannedDisplayColumnTypes = [
"link",
"array",
"attachment",
"boolean",
"json",
]
if (bannedDisplayColumnTypes.includes(column.schema.type)) {
return false
}
if (
column.schema.type === FieldType.BB_REFERENCE &&
column.schema.subtype === FieldSubtype.USERS
) {
return false
}
return true
}
onMount(() => subscribe("close-edit-column", cancelEdit))
</script>
@ -246,7 +233,8 @@
<MenuItem
icon="Label"
on:click={makeDisplayColumn}
disabled={idx === "sticky" || !canBeDisplayColumn(column)}
disabled={idx === "sticky" ||
bannedDisplayColumnTypes.includes(column.schema.type)}
>
Use as display column
</MenuItem>