2023-10-10 15:53:10 +02:00
|
|
|
import { FieldType } from "@budibase/types"
|
2023-10-10 15:50:12 +02:00
|
|
|
|
|
|
|
const allowDisplayColumnByType: Record<FieldType, boolean> = {
|
|
|
|
[FieldType.STRING]: true,
|
|
|
|
[FieldType.LONGFORM]: true,
|
|
|
|
[FieldType.OPTIONS]: true,
|
|
|
|
[FieldType.NUMBER]: true,
|
|
|
|
[FieldType.DATETIME]: true,
|
|
|
|
[FieldType.FORMULA]: true,
|
|
|
|
[FieldType.AUTO]: true,
|
|
|
|
[FieldType.INTERNAL]: true,
|
|
|
|
[FieldType.BARCODEQR]: true,
|
|
|
|
[FieldType.BIGINT]: true,
|
|
|
|
[FieldType.BOOLEAN]: false,
|
|
|
|
[FieldType.ARRAY]: false,
|
2024-04-03 10:44:35 +02:00
|
|
|
[FieldType.ATTACHMENTS]: false,
|
2024-03-26 11:38:55 +01:00
|
|
|
[FieldType.ATTACHMENT_SINGLE]: false,
|
2023-10-10 15:50:12 +02:00
|
|
|
[FieldType.LINK]: false,
|
|
|
|
[FieldType.JSON]: false,
|
|
|
|
[FieldType.BB_REFERENCE]: false,
|
|
|
|
}
|
|
|
|
|
2023-10-18 16:38:37 +02:00
|
|
|
const allowSortColumnByType: Record<FieldType, boolean> = {
|
|
|
|
[FieldType.STRING]: true,
|
|
|
|
[FieldType.LONGFORM]: true,
|
|
|
|
[FieldType.OPTIONS]: true,
|
|
|
|
[FieldType.NUMBER]: true,
|
|
|
|
[FieldType.DATETIME]: true,
|
|
|
|
[FieldType.AUTO]: true,
|
|
|
|
[FieldType.INTERNAL]: true,
|
|
|
|
[FieldType.BARCODEQR]: true,
|
|
|
|
[FieldType.BIGINT]: true,
|
|
|
|
[FieldType.BOOLEAN]: true,
|
|
|
|
[FieldType.JSON]: true,
|
|
|
|
|
|
|
|
[FieldType.FORMULA]: false,
|
2024-04-03 10:44:35 +02:00
|
|
|
[FieldType.ATTACHMENTS]: false,
|
2024-03-26 11:38:55 +01:00
|
|
|
[FieldType.ATTACHMENT_SINGLE]: false,
|
2023-10-18 16:38:37 +02:00
|
|
|
[FieldType.ARRAY]: false,
|
|
|
|
[FieldType.LINK]: false,
|
|
|
|
[FieldType.BB_REFERENCE]: false,
|
|
|
|
}
|
|
|
|
|
2023-10-10 15:50:12 +02:00
|
|
|
export function canBeDisplayColumn(type: FieldType): boolean {
|
|
|
|
return !!allowDisplayColumnByType[type]
|
|
|
|
}
|
2023-10-18 16:38:37 +02:00
|
|
|
|
|
|
|
export function canBeSortColumn(type: FieldType): boolean {
|
|
|
|
return !!allowSortColumnByType[type]
|
|
|
|
}
|