Type sort store
This commit is contained in:
parent
078053a417
commit
56fe3ce6fe
|
@ -173,7 +173,7 @@ export const initialise = (context: StoreContext) => {
|
|||
await datasource.actions.saveDefinition({
|
||||
...$view,
|
||||
sort: {
|
||||
field: $sort.column,
|
||||
field: $sort.column!,
|
||||
order: $sort.order || SortOrder.ASCENDING,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -95,7 +95,6 @@ export type Store = BaseStore &
|
|||
Clipboard.Store &
|
||||
Scroll.Store & {
|
||||
// TODO while typing the rest of stores
|
||||
sort: Writable<any>
|
||||
subscribe: any
|
||||
dispatch: (event: string, data: any) => any
|
||||
width: Writable<number>
|
||||
|
@ -108,7 +107,8 @@ export type Store = BaseStore &
|
|||
Conditions.Store &
|
||||
Cache.Store &
|
||||
Viewport.Store &
|
||||
Notifications.Store
|
||||
Notifications.Store &
|
||||
Sort.Store
|
||||
|
||||
export const attachStores = (context: Store): Store => {
|
||||
// Atomic store creation
|
||||
|
|
|
@ -1,9 +1,18 @@
|
|||
import { derived, get } from "svelte/store"
|
||||
import { derived, get, Writable } from "svelte/store"
|
||||
import { memo } from "../../../utils"
|
||||
import { SortOrder } from "@budibase/types"
|
||||
import { Store as StoreContext } from "."
|
||||
|
||||
export const createStores = (context: StoreContext) => {
|
||||
interface SortStore {
|
||||
sort: Writable<{
|
||||
column: string | null | undefined
|
||||
order: SortOrder
|
||||
}>
|
||||
}
|
||||
|
||||
export type Store = SortStore
|
||||
|
||||
export const createStores = (context: StoreContext): SortStore => {
|
||||
const { props } = context
|
||||
const $props = get(props)
|
||||
|
||||
|
|
Loading…
Reference in New Issue