Types
This commit is contained in:
parent
c682a43d9a
commit
dc0f16747e
|
@ -1,11 +1,16 @@
|
|||
import { get, derived, Writable } from "svelte/store"
|
||||
import { FieldType, UILogicalOperator } from "@budibase/types"
|
||||
import {
|
||||
FieldType,
|
||||
UIColumn,
|
||||
UIInlineFilter,
|
||||
UILogicalOperator,
|
||||
} from "@budibase/types"
|
||||
import { Store as StoreContext } from "."
|
||||
import { memo } from "../../../utils/memo"
|
||||
|
||||
export interface FilterStore {
|
||||
filter: Writable<any>
|
||||
inlineFilters: Writable<any>
|
||||
inlineFilters: Writable<UIInlineFilter[]>
|
||||
}
|
||||
|
||||
export interface FilterDerivedStore {
|
||||
|
@ -63,10 +68,10 @@ export const deriveStores = (context: StoreContext) => {
|
|||
export const createActions = (context: StoreContext) => {
|
||||
const { filter, inlineFilters } = context
|
||||
|
||||
const addInlineFilter = (column, value) => {
|
||||
const addInlineFilter = (column: UIColumn, value: string) => {
|
||||
const filterId = `inline-${column.name}`
|
||||
const type = column.schema.type
|
||||
let inlineFilter = {
|
||||
const inlineFilter: UIInlineFilter = {
|
||||
field: column.name,
|
||||
id: filterId,
|
||||
operator: "string",
|
||||
|
|
|
@ -9,7 +9,7 @@ export type UIColumn = FieldSchema & {
|
|||
subField: string
|
||||
}
|
||||
primaryDisplay?: boolean
|
||||
schema?: {
|
||||
schema: {
|
||||
disabled: boolean
|
||||
type: FieldType
|
||||
readonly: boolean
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { FieldType } from "@budibase/types"
|
||||
|
||||
export interface UIInlineFilter {
|
||||
field: string
|
||||
type: FieldType
|
||||
value: number | string
|
||||
operator: string
|
||||
id: string
|
||||
valueType: string
|
||||
}
|
|
@ -3,3 +3,4 @@ export * from "./datasource"
|
|||
export * from "./table"
|
||||
export * from "./view"
|
||||
export * from "./user"
|
||||
export * from "./filters"
|
||||
|
|
Loading…
Reference in New Issue