1
0
Fork 0
mirror of synced 2024-07-08 15:56:23 +12:00

Type renderers

This commit is contained in:
Adria Navarro 2024-03-26 10:19:52 +01:00
parent fcda81434c
commit 3d45dcea5f
2 changed files with 16 additions and 13 deletions

View file

@ -8,6 +8,7 @@
"dependencies": { "dependencies": {
"@budibase/bbui": "0.0.0", "@budibase/bbui": "0.0.0",
"@budibase/shared-core": "0.0.0", "@budibase/shared-core": "0.0.0",
"@budibase/types": "0.0.0",
"dayjs": "^1.10.8", "dayjs": "^1.10.8",
"lodash": "4.17.21", "lodash": "4.17.21",
"socket.io-client": "^4.6.1" "socket.io-client": "^4.6.1"

View file

@ -1,3 +1,5 @@
import { FieldType } from "@budibase/types"
import OptionsCell from "../cells/OptionsCell.svelte" import OptionsCell from "../cells/OptionsCell.svelte"
import DateCell from "../cells/DateCell.svelte" import DateCell from "../cells/DateCell.svelte"
import MultiSelectCell from "../cells/MultiSelectCell.svelte" import MultiSelectCell from "../cells/MultiSelectCell.svelte"
@ -12,19 +14,19 @@ import AttachmentCell from "../cells/AttachmentCell.svelte"
import BBReferenceCell from "../cells/BBReferenceCell.svelte" import BBReferenceCell from "../cells/BBReferenceCell.svelte"
const TypeComponentMap = { const TypeComponentMap = {
text: TextCell, [FieldType.STRING]: TextCell,
options: OptionsCell, [FieldType.OPTIONS]: OptionsCell,
datetime: DateCell, [FieldType.DATETIME]: DateCell,
barcodeqr: TextCell, [FieldType.BARCODEQR]: TextCell,
longform: LongFormCell, [FieldType.LONGFORM]: LongFormCell,
array: MultiSelectCell, [FieldType.ARRAY]: MultiSelectCell,
number: NumberCell, [FieldType.NUMBER]: NumberCell,
boolean: BooleanCell, [FieldType.BOOLEAN]: BooleanCell,
attachment: AttachmentCell, [FieldType.ATTACHMENT]: AttachmentCell,
link: RelationshipCell, [FieldType.LINK]: RelationshipCell,
formula: FormulaCell, [FieldType.FORMULA]: FormulaCell,
json: JSONCell, [FieldType.JSON]: JSONCell,
bb_reference: BBReferenceCell, [FieldType.BB_REFERENCE]: BBReferenceCell,
} }
export const getCellRenderer = column => { export const getCellRenderer = column => {
return TypeComponentMap[column?.schema?.type] || TextCell return TypeComponentMap[column?.schema?.type] || TextCell