Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type fields #15706

Merged
merged 15 commits into from
Mar 13, 2025
Prev Previous commit
Next Next commit
Type context usages
  • Loading branch information
adrinr committed Mar 10, 2025
commit 07f90746d2788149fbd6e457202215cef1d630a9
4 changes: 2 additions & 2 deletions packages/client/src/components/app/forms/Field.svelte
Original file line number Diff line number Diff line change
@@ -29,8 +29,8 @@

// Get contexts
const formContext = getContext("form")
const formStepContext: any = getContext("form-step")
const fieldGroupContext: any = getContext("field-group")
const formStepContext = getContext("form-step")
const fieldGroupContext = getContext("field-group")
const { styleable, builderStore, Provider } = getContext("sdk")
const component = getContext("component")

7 changes: 5 additions & 2 deletions packages/client/src/context.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Component, Context, FormContext, SDK } from "."
import { Writable } from "svelte"
import { Component, Context, FieldGroupContext, FormContext, SDK } from "."

declare module "svelte" {
export function getContext(key: "sdk"): SDK
export function getContext(key: "component"): Component
export function getContext(key: "context"): Context
export function getContext(key: "form"): FormContext
export function getContext(key: "form"): FormContext | undefined
export function getContext(key: "form-step"): Writable<number> | undefined
export function getContext(key: "field-group"): FieldGroupContext | undefined
}
4 changes: 4 additions & 0 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -126,6 +126,10 @@ export interface FormField {
fieldSchema: FieldSchema
}

export interface FieldGroupContext {
labelPosition: string
}

let app: ClientApp

const loadBudibase = async () => {