Add user/users column types

This commit is contained in:
Adria Navarro 2024-04-22 12:32:51 +02:00
parent afdbf4cc42
commit 2555a145b2
3 changed files with 15 additions and 11 deletions

View File

@ -373,10 +373,6 @@
.map(([_, fieldDefinition]) => fieldDefinition)
}
const isUsers =
editableColumn.type === FieldType.BB_REFERENCE &&
editableColumn.subtype === FieldSubtype.USERS
if (!externalTable) {
return [
FIELDS.STRING,
@ -393,7 +389,8 @@
FIELDS.LINK,
FIELDS.FORMULA,
FIELDS.JSON,
isUsers ? FIELDS.USERS : FIELDS.USER,
FIELDS.USER,
FIELDS.USERS,
FIELDS.AUTO,
]
} else {
@ -407,7 +404,8 @@
FIELDS.BOOLEAN,
FIELDS.FORMULA,
FIELDS.BIGINT,
isUsers ? FIELDS.USERS : FIELDS.USER,
FIELDS.USER,
FIELDS.USERS,
]
// no-sql or a spreadsheet
if (!externalTable || table.sql) {

View File

@ -4,6 +4,7 @@ import {
INTERNAL_TABLE_SOURCE_ID,
AutoFieldSubType,
Hosting,
FieldTypeSubtypes,
} from "@budibase/types"
import { Constants } from "@budibase/frontend-core"
@ -159,15 +160,19 @@ export const FIELDS = {
},
USER: {
name: "User",
type: FieldType.BB_REFERENCE,
type: FieldType.BB_REFERENCE_SINGLE,
subtype: FieldSubtype.USER,
icon: TypeIconMap[FieldType.USER],
icon: TypeIconMap[FieldType.BB_REFERENCE_SINGLE][
FieldTypeSubtypes.BB_REFERENCE.USER
],
},
USERS: {
name: "Users",
type: FieldType.BB_REFERENCE,
subtype: FieldSubtype.USERS,
icon: TypeIconMap[FieldType.USERS],
icon: TypeIconMap[FieldType.BB_REFERENCE][
FieldTypeSubtypes.BB_REFERENCE.USERS
],
constraints: {
type: "array",
},

View File

@ -131,10 +131,11 @@ export const TypeIconMap = {
[FieldType.JSON]: "Brackets",
[FieldType.BIGINT]: "TagBold",
[FieldType.AUTO]: "MagicWand",
[FieldType.USER]: "User",
[FieldType.USERS]: "UserGroup",
[FieldType.BB_REFERENCE]: {
[FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
[FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup",
},
[FieldType.BB_REFERENCE_SINGLE]: {
[FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
},
}