Convert getBindings formula to ts
This commit is contained in:
parent
5fb2a6ea2c
commit
bbd56eac8e
|
@ -1,4 +1,4 @@
|
||||||
import { FieldType } from "@budibase/types"
|
import { FieldType, Table, UIBinding } from "@budibase/types"
|
||||||
import { FIELDS } from "@/constants/backend"
|
import { FIELDS } from "@/constants/backend"
|
||||||
import { tables } from "@/stores/builder"
|
import { tables } from "@/stores/builder"
|
||||||
import { get as svelteGet } from "svelte/store"
|
import { get as svelteGet } from "svelte/store"
|
||||||
|
@ -21,8 +21,13 @@ export function getBindings({
|
||||||
path = null,
|
path = null,
|
||||||
category = null,
|
category = null,
|
||||||
depth = 0,
|
depth = 0,
|
||||||
|
}: {
|
||||||
|
table: Table | undefined
|
||||||
|
path: string | null
|
||||||
|
category: string | null
|
||||||
|
depth: number
|
||||||
}) {
|
}) {
|
||||||
let bindings = []
|
let bindings: UIBinding[] = []
|
||||||
if (!table) {
|
if (!table) {
|
||||||
return bindings
|
return bindings
|
||||||
}
|
}
|
||||||
|
@ -58,7 +63,7 @@ export function getBindings({
|
||||||
}
|
}
|
||||||
const field = Object.values(FIELDS).find(
|
const field = Object.values(FIELDS).find(
|
||||||
field => field.type === schema.type
|
field => field.type === schema.type
|
||||||
)
|
)!
|
||||||
|
|
||||||
const label = path == null ? column : `${path}.0.${column}`
|
const label = path == null ? column : `${path}.0.${column}`
|
||||||
const binding = path == null ? `[${column}]` : `[${path}].0.[${column}]`
|
const binding = path == null ? `[${column}]` : `[${path}].0.[${column}]`
|
|
@ -28,7 +28,16 @@ export interface UIBinding {
|
||||||
prefixKeys?: string
|
prefixKeys?: string
|
||||||
}
|
}
|
||||||
component?: string
|
component?: string
|
||||||
providerId: string
|
providerId?: string
|
||||||
readableBinding?: string
|
readableBinding?: string
|
||||||
runtimeBinding?: string
|
runtimeBinding?: string
|
||||||
|
label?: string
|
||||||
|
path?: string
|
||||||
|
type: string
|
||||||
|
category?: string
|
||||||
|
description?: string
|
||||||
|
display: {
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue