Type grid svelte file
This commit is contained in:
parent
d476a5c5cd
commit
51c7fe8c5b
|
@ -1,4 +1,4 @@
|
|||
<script>
|
||||
<script lang="ts">
|
||||
import { setContext, onMount } from "svelte"
|
||||
import { writable, derived } from "svelte/store"
|
||||
import { fade } from "svelte/transition"
|
||||
|
@ -53,17 +53,16 @@
|
|||
const gridID = `grid-${Math.random().toString().slice(2)}`
|
||||
|
||||
// Store props in a store for reference in other stores
|
||||
const props = writable($$props)
|
||||
const props: any = writable($$props)
|
||||
|
||||
// Build up context
|
||||
let context = {
|
||||
let context = attachStores({
|
||||
API: API || createAPIClient(),
|
||||
Constants,
|
||||
gridID,
|
||||
props,
|
||||
}
|
||||
context = { ...context, ...createEventManagers() }
|
||||
context = attachStores(context)
|
||||
...createEventManagers(),
|
||||
})
|
||||
|
||||
// Reference some stores for local use
|
||||
const {
|
||||
|
|
|
@ -25,6 +25,7 @@ import * as NonPlus from "./datasources/nonPlus"
|
|||
import * as Cache from "./cache"
|
||||
import * as Conditions from "./conditions"
|
||||
import { SortOrder, UIDatasource, UISearchFilter } from "@budibase/types"
|
||||
import * as Constants from "../lib/constants"
|
||||
|
||||
const DependencyOrderedStores = [
|
||||
Sort,
|
||||
|
@ -73,6 +74,7 @@ export interface BaseStoreProps {
|
|||
canEditColumns?: boolean
|
||||
canExpandRows?: boolean
|
||||
canSaveSchema?: boolean
|
||||
minHeight?: number
|
||||
}
|
||||
|
||||
export interface BaseStore {
|
||||
|
@ -81,6 +83,7 @@ export interface BaseStore {
|
|||
props: Writable<BaseStoreProps>
|
||||
subscribe: any
|
||||
dispatch: (event: string, data: any) => any
|
||||
Constants: typeof Constants
|
||||
}
|
||||
|
||||
export type Store = BaseStore &
|
||||
|
@ -107,7 +110,7 @@ export type Store = BaseStore &
|
|||
Sort.Store &
|
||||
Bounds.Store
|
||||
|
||||
export const attachStores = (context: Store): Store => {
|
||||
export const attachStores = (context: BaseStore): Store => {
|
||||
// Atomic store creation
|
||||
for (let store of DependencyOrderedStores) {
|
||||
if ("createStores" in store) {
|
||||
|
|
Loading…
Reference in New Issue