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({
|
await datasource.actions.saveDefinition({
|
||||||
...$view,
|
...$view,
|
||||||
sort: {
|
sort: {
|
||||||
field: $sort.column,
|
field: $sort.column!,
|
||||||
order: $sort.order || SortOrder.ASCENDING,
|
order: $sort.order || SortOrder.ASCENDING,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -95,7 +95,6 @@ export type Store = BaseStore &
|
||||||
Clipboard.Store &
|
Clipboard.Store &
|
||||||
Scroll.Store & {
|
Scroll.Store & {
|
||||||
// TODO while typing the rest of stores
|
// TODO while typing the rest of stores
|
||||||
sort: Writable<any>
|
|
||||||
subscribe: any
|
subscribe: any
|
||||||
dispatch: (event: string, data: any) => any
|
dispatch: (event: string, data: any) => any
|
||||||
width: Writable<number>
|
width: Writable<number>
|
||||||
|
@ -108,7 +107,8 @@ export type Store = BaseStore &
|
||||||
Conditions.Store &
|
Conditions.Store &
|
||||||
Cache.Store &
|
Cache.Store &
|
||||||
Viewport.Store &
|
Viewport.Store &
|
||||||
Notifications.Store
|
Notifications.Store &
|
||||||
|
Sort.Store
|
||||||
|
|
||||||
export const attachStores = (context: Store): Store => {
|
export const attachStores = (context: Store): Store => {
|
||||||
// Atomic store creation
|
// 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 { memo } from "../../../utils"
|
||||||
import { SortOrder } from "@budibase/types"
|
import { SortOrder } from "@budibase/types"
|
||||||
import { Store as StoreContext } from "."
|
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 } = context
|
||||||
const $props = get(props)
|
const $props = get(props)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue