Split types
This commit is contained in:
parent
7c6e9644ca
commit
e474a5ae23
|
@ -2,7 +2,7 @@
|
|||
import { onMount } from "svelte"
|
||||
import { Input, Label } from "@budibase/bbui"
|
||||
import { previewStore, selectedScreen } from "@/stores/builder"
|
||||
import type { ComponentContext } from "@budibase/types"
|
||||
import type { AppContext, ComponentContext } from "@budibase/types"
|
||||
|
||||
export let baseRoute = ""
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
// This function is needed to repopulate the test value from componentContext
|
||||
// when a user navigates to another component and then back again
|
||||
const updateTestValueFromContext = (context: ComponentContext | null) => {
|
||||
const updateTestValueFromContext = (context: AppContext | null) => {
|
||||
if (context?.url && !testValue) {
|
||||
const { wild, ...urlParams } = context.url
|
||||
const queryParams = context.query
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { get } from "svelte/store"
|
||||
import { BudiStore } from "../BudiStore"
|
||||
import { PreviewDevice, ComponentContext } from "@budibase/types"
|
||||
import { PreviewDevice, ComponentContext, AppContext } from "@budibase/types"
|
||||
|
||||
type PreviewEventHandler = (name: string, payload?: any) => void
|
||||
|
||||
|
@ -8,7 +8,7 @@ interface PreviewState {
|
|||
previewDevice: PreviewDevice
|
||||
previewEventHandler: PreviewEventHandler | null
|
||||
showPreview: boolean
|
||||
selectedComponentContext: ComponentContext | null
|
||||
selectedComponentContext: AppContext | null
|
||||
}
|
||||
|
||||
const INITIAL_PREVIEW_STATE: PreviewState = {
|
||||
|
|
|
@ -58,17 +58,26 @@ export interface ComponentSetting {
|
|||
self: boolean
|
||||
}
|
||||
}
|
||||
interface ComponentAction {
|
||||
type: string
|
||||
suffix?: string
|
||||
}
|
||||
|
||||
interface ComponentStaticContextValue {
|
||||
label: string
|
||||
key: string
|
||||
type: string // technically this is a long list of options but there are too many to enumerate
|
||||
}
|
||||
|
||||
export interface ComponentContext {
|
||||
type: ComponentContextType
|
||||
scope: ComponentContextScopes
|
||||
actions: any[]
|
||||
url?: Record<string, any>
|
||||
query?: string
|
||||
state?: Record<string, any>
|
||||
scope?: ComponentContextScopes
|
||||
actions?: ComponentAction[]
|
||||
suffix?: string
|
||||
values?: ComponentStaticContextValue[]
|
||||
}
|
||||
|
||||
export type ComponentContextType = "context" | "action"
|
||||
export type ComponentContextType = "action" | "static" | "schema" | "form"
|
||||
|
||||
export const enum ComponentContextScopes {
|
||||
Local = "local",
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
export type PreviewDevice = "desktop" | "tablet" | "mobile"
|
||||
|
||||
export type AppContext = Record<string, any>
|
||||
|
|
Loading…
Reference in New Issue