This commit is contained in:
Adria Navarro 2024-12-20 13:36:40 +01:00
parent 10615bbce4
commit acc9da3876
2 changed files with 13 additions and 12 deletions

View File

@ -3,11 +3,11 @@ import { DefaultColumnWidth, GutterWidth } from "../lib/constants"
import { CalculationType, FieldSchema, FieldType } from "@budibase/types"
import { Store as StoreContext } from "."
export interface Store {
interface ColumnStore {
columns: Writable<Column[]>
}
export interface DerivedStore {
interface DerivedColumnStore {
tableColumns: Readable<Column[]>
displayColumn: Readable<Column>
columnLookupMap: Readable<Record<string, Column>>
@ -16,6 +16,8 @@ export interface DerivedStore {
hasNonAutoColumn: Readable<boolean>
}
export type Store = ColumnStore & DerivedColumnStore
type Column = FieldSchema & {
label: string
readonly: boolean
@ -34,7 +36,7 @@ type Column = FieldSchema & {
calculationType: CalculationType
}
export const createStores = (): Store => {
export const createStores = (): ColumnStore => {
const columns = writable([])
// Enrich columns with metadata about their display position
@ -63,7 +65,7 @@ export const createStores = (): Store => {
}
}
export const deriveStores = (context: StoreContext): DerivedStore => {
export const deriveStores = (context: StoreContext): DerivedColumnStore => {
const { columns } = context
// Derive a lookup map for all columns by name

View File

@ -50,14 +50,13 @@ const DependencyOrderedStores = [
Cache,
]
export type Store = Columns.Store &
Columns.DerivedStore & {
// TODO while typing the rest of stores
datasource: any
definition: Writable<any>
displayColumn: Writable<any>
enrichedSchema: any
}
export type Store = Columns.Store & {
// TODO while typing the rest of stores
datasource: any
definition: Writable<any>
displayColumn: Writable<any>
enrichedSchema: any
}
export const attachStores = (context): Store => {
// Atomic store creation