Convert getBindings formula to ts

This commit is contained in:
Adria Navarro 2025-02-18 10:41:54 +01:00
parent 5fb2a6ea2c
commit bbd56eac8e
2 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import { FieldType } from "@budibase/types"
import { FieldType, Table, UIBinding } from "@budibase/types"
import { FIELDS } from "@/constants/backend"
import { tables } from "@/stores/builder"
import { get as svelteGet } from "svelte/store"
@ -21,8 +21,13 @@ export function getBindings({
path = null,
category = null,
depth = 0,
}: {
table: Table | undefined
path: string | null
category: string | null
depth: number
}) {
let bindings = []
let bindings: UIBinding[] = []
if (!table) {
return bindings
}
@ -58,7 +63,7 @@ export function getBindings({
}
const field = Object.values(FIELDS).find(
field => field.type === schema.type
)
)!
const label = path == null ? column : `${path}.0.${column}`
const binding = path == null ? `[${column}]` : `[${path}].0.[${column}]`

View File

@ -28,7 +28,16 @@ export interface UIBinding {
prefixKeys?: string
}
component?: string
providerId: string
providerId?: string
readableBinding?: string
runtimeBinding?: string
label?: string
path?: string
type: string
category?: string
description?: string
display: {
name: string
type: string
}
}