Improve typings

This commit is contained in:
Adria Navarro 2024-12-20 11:59:57 +01:00
parent e70dc86202
commit 675e195708
2 changed files with 12 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { derived, get, Writable, writable } from "svelte/store"
import { DefaultColumnWidth, GutterWidth } from "../lib/constants"
import { FieldSchema } from "@budibase/types"
import { CalculationType, FieldSchema } from "@budibase/types"
import { StoreContext } from "."
export interface Store {
@ -8,15 +8,18 @@ export interface Store {
}
type Column = FieldSchema & {
label: string
readonly: boolean
conditions: any
related?: {
field: string
subField: string
}
primaryDisplay: boolean
primaryDisplay?: boolean
schema?: {
autocolumn: boolean
}
calculationType: CalculationType
}
export const createStores = (): Store => {
@ -169,7 +172,8 @@ export const initialise = (context: StoreContext) => {
.map(field => {
const fieldSchema = $enrichedSchema[field]
const oldColumn = $columns?.find(col => col.name === field)
const column = {
const column: Column = {
type: fieldSchema.type,
name: field,
label: fieldSchema.displayName || field,
schema: fieldSchema,

View File

@ -1,3 +1,5 @@
import { Writable } from "svelte/store"
import * as Bounds from "./bounds"
import * as Columns from "./columns"
import * as Menu from "./menu"
@ -75,7 +77,7 @@ export const attachStores = context => {
export interface StoreContext {
columns: Columns.Store["columns"]
datasource: any
definition: any
displayColumn: any
definition: Writable<any>
displayColumn: Writable<any>
enrichedSchema: any
}