Simplify
This commit is contained in:
parent
0909e0547e
commit
6f77be622f
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue