More types

This commit is contained in:
Adria Navarro 2024-04-03 12:13:33 +02:00
parent 3d45dcea5f
commit edd3ce8f0f
2 changed files with 15 additions and 29 deletions

View File

@ -1,21 +1,7 @@
import { FieldTypeToComponentMap } from "components/design/settings/controls/FieldConfiguration/utils"
import { Component } from "./Component"
import { getSchemaForDatasource } from "dataBinding"
const fieldTypeToComponentMap = {
string: "stringfield",
number: "numberfield",
bigint: "bigintfield",
options: "optionsfield",
array: "multifieldselect",
boolean: "booleanfield",
longform: "longformfield",
datetime: "datetimefield",
attachment: "attachmentfield",
link: "relationshipfield",
json: "jsonfield",
barcodeqr: "codescanner",
}
export function makeDatasourceFormComponents(datasource) {
const { schema } = getSchemaForDatasource(null, datasource, {
formSchema: true,
@ -30,7 +16,7 @@ export function makeDatasourceFormComponents(datasource) {
}
const fieldType =
typeof fieldSchema === "object" ? fieldSchema.type : fieldSchema
const componentType = fieldTypeToComponentMap[fieldType]
const componentType = FieldTypeToComponentMap[fieldType]
const fullComponentType = `@budibase/standard-components/${componentType}`
if (componentType) {
const component = new Component(fullComponentType)

View File

@ -7,19 +7,19 @@
export let order
const FieldTypeToComponentMap = {
string: "stringfield",
number: "numberfield",
bigint: "bigintfield",
options: "optionsfield",
array: "multifieldselect",
boolean: "booleanfield",
longform: "longformfield",
datetime: "datetimefield",
attachment: "attachmentfield",
link: "relationshipfield",
json: "jsonfield",
barcodeqr: "codescanner",
bb_reference: "bbreferencefield",
[FieldType.STRING]: "stringfield",
[FieldType.NUMBER]: "numberfield",
[FieldType.BIGINT]: "bigintfield",
[FieldType.OPTIONS]: "optionsfield",
[FieldType.ARRAY]: "multifieldselect",
[FieldType.BOOLEAN]: "booleanfield",
[FieldType.LONGFORM]: "longformfield",
[FieldType.DATETIME]: "datetimefield",
[FieldType.ATTACHMENT]: "attachmentfield",
[FieldType.LINK]: "relationshipfield",
[FieldType.JSON]: "jsonfield",
[FieldType.BARCODEQR]: "codescanner",
[FieldType.BB_REFERENCE]: "bbreferencefield",
}
const getFieldSchema = field => {